Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions