Question: Create a class called Fruit that has four instance private variables: Name : of type string Country : of type string : The country from
Create a class called Fruit that has four instance private variables: Name : of type string Country : of type string : The country from which is imported : Price : of type double Quantity: of type integer : the available quantity of the fruit. The class should also include the following methods: 1. A constructor with parameters for the different instances variables. 2. A default constructor 3. A set method to update the Price 4. 3 set methods to update respectively the name, country and quantity, 5. Four get methods to get respectively the value of each instance variable Create a program that tests the class Fruit described in the previous question, as follow: 1. Create three objects named Mango, Apple and Orange of type Fruit : Name Mango Apple Orange Country India Italia Tunisia Price 0.95 0.8 Quantity 100 150 200 2. Display the different instance variables of the Fruit Orange. 3. Update the price of the fruit Mango to the value 1.5 4. Display the total number of Fruits. 5. Display the different instance variables of the Fruit Mango
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
