One of the renowned supermarket in Dhaka City, “Shwapno” is celebrating their first anniversary of opening. They have become very popular among people in a short amount of time. As a method of celebration they have designed three interesting and exciting offer for their customers for that day only!! The offers are described as follows: Offer 1: This offer says, if the name of any customer starts with “S” OR ends with “o”, they will receive a gift which contains 1 kg miniket rice and 1 litre soyabean oil. This offer is dedicated from their name, Shwapno. Offer 2: This offer says, if one customer have taken products and his/her total product weight is less than 1.50 kg, then Shwapno will give all the products to the customer for free. If the total weight is 1.50 kg or more, the customer will have to pay the full amount. Offer 3: This offer says, if a customer is aged less than 15, then he/she will receive chocolates. If aged 15 or more, then no gifts for the customer. Implementation: Create three custom exception classes which represents each offer given above. You may give any names you like to the custom exception classes. Create a class named, Shwapno, containing three methods checkName(), checkproductWeight() and checkAge(), which will throw the custom exceptions you created. In the main, create an object of class Shwapno. Now take name, age and product weight from the user, and call the methods of that in try block followed by a catch block. Output must contain:  Exception output  Normal output

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Scenario:
One of the renowned supermarket in Dhaka City, “Shwapno” is celebrating their first
anniversary of opening. They have become very popular among people in a short amount of
time. As a method of celebration they have designed three interesting and exciting offer for their
customers for that day only!! The offers are described as follows:
Offer 1: This offer says, if the name of any customer starts with “S” OR ends with “o”, they
will receive a gift which contains 1 kg miniket rice and 1 litre soyabean oil. This offer is
dedicated from their name, Shwapno.
Offer 2: This offer says, if one customer have taken products and his/her total product weight
is less than 1.50 kg, then Shwapno will give all the products to the customer for free. If the total
weight is 1.50 kg or more, the customer will have to pay the full amount.
Offer 3: This offer says, if a customer is aged less than 15, then he/she will receive chocolates.
If aged 15 or more, then no gifts for the customer.
Implementation:
Create three custom exception classes which represents each offer given above. You may give
any names you like to the custom exception classes.
Create a class named, Shwapno, containing three methods checkName(), checkproductWeight()
and checkAge(), which will throw the custom exceptions you created.
In the main, create an object of class Shwapno. Now take name, age and product weight from the
user, and call the methods of that in try block followed by a catch block.
Output must contain:
 Exception output
 Normal output

Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY