1 Grocery List Provided Item Unit Price Quantity Milk 475 1 Bread 250 2 Eggs 400 3 Create Q37138764

1. A grocery list is provided below:

Item   Unit price     Quantity

Milk     $4.75             1

Bread $2.50             2

Eggs    $4.00             3

Create three different classes named Milk,Bread, and Eggs, where each hasthe following members :

· private data member “unit_price

· private data member “quantity”.

· Default and overloaded constructors

· Provide properties for the private data members

· public total_price method whichreturns the total price (e.g., unit_price ×quantity)

· A ToString() method that returns the info of the object

Create a class named Grocery, which has thefollowing members

· my_milk of type Milk

· my_bread of type Bread

· my_eggs of type Eggs

· An overloaded constructor which takes all the items above asinputs

· An expense method which

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.