Question: C++ 1) Design a class called Product that has the following member variables: e description. A string that holds the description of the product. price.
1) Design a class called Product that has the following member variables: e description. A string that holds the description of the product. price. A double variable that holds the price of the product. The class should have the following member functions: A default constructor that assigns 0 to the price variable. A constructor that accepts the following values as arguments and assign them to the appropriate member variables: the description of the product and the price of the product. setDescription: Stores a value in description setPrice: Stores a value in price getDescription: Returns the value in description getPrice: Returns the value in price 2) Design a class called LineItem that has the following member variables: prod. A Product object. quantity. An integer variable that holds the quantity The class should have the following member functions A default constructor that assigns 0 to the quantity variable A constructor that accepts the following as arguments and assign them to the appropriate member variables: a product object and a quantity getTotalPrice: Returns the total price (Computes the total cost of this line item). print: Prints the line item. It prints the description of the product, the price of the product, the quantity, and the total price of the line item e The program should ask the user for the description, the price, and the quantity and will then display the information as in the following screenshot. iption of your iten: 6GB White Snartphone nter the price of your iten: 78.88 nter the quantity: escription Price Quantity Total Price 578.0 6GB White Snartphone 2858.0 ress any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
