$30
There is a method of a class named calculate Sum which takes a file as input and shows the sum
of the integers written in decimal format separated by spaces in the file. Now write an adapter for
this so that it can be applied on a file that contains decimal numbers separated by ‘~’ character.
You have to write methods for calculating the sum and the adapter and demonstrate using
practical data.
Assignment # 3b
Consider a burger shop selling burger, appetizer and drinks. The following points describe the
services provided to the customer.
1. Three different types of burgers are being sold: Veggi, Beef and Chicken
2. There are provisions to add cheese on those burgers
3. There are provisions of different types of drinks: Coffee, Water and Coke. The prices of these
different types of drinks are different. The customer can select one or more drinks in an order
4. Onion Rings and French Fries are two different types of appetizers available.
5. A customer can order a meal which consists of an appetizer, a burger with necessary cheese
and drinks.
Construct a class indicating the following using decorator pattern:
1. Beef burger with French fry and cheese
2. Veggi Pizza with onion rings and Bottle of Water
3. A combo meal with Veggi burger, French Fry and Coke
4. A combo meal with Veggi burger, Onion Rings, Coffee and Water
5. A Beef burger only
In each of the cases determine the price of the options shown above as a method of the class to
be created. All the items mentioned above must have a particular price defined by the methods of
a class.