Question: (a) Write a C++ class for a fruit basket. The following are the properties: Fruit Basket apples = an integer equal to the number of

(a) Write a C++ class for a fruit basket. The following are the properties: Fruit Basket apples = an integer equal to the number of apples in the basket oranges = an integer equal to the number of oranges in the basket peaches = an integer equal to the number of peaches in the basket getApples rightarrow returns an integer equal to the number of apples getOranges rightarrow returns a integer equal to the number of oranges getPeaches rightarrow returns an integer equal to the number of oranges getTotal rightarrow returns the total number of apples and oranges (b) Write a main C++ function that will: 1. Instantiate and object called myBasket of the class FruitBasket 2. Assign a value of 5 to the apples field of myBasket 3. Assign a value of 7 to the oranges field of myBasket 4. Assign a value of 10 to the peaches field of myBasket 5. Use the method getTotal to display the total number of fruit items in the basket 6. Use the "using" statement to define the namespace
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
