Question: 1 . Write a C + + code that has a class named Product . The class Product should have the following attributes: int product

1. Write a C++ code that has a class named "Product. The class Product should have the following attributes: int product id; string name; float price, quantity, discount; Write a default constructor, a destructor, and a constructor function that initializes the object. Your destructor function should display the message "Object is destroyed.. Your class should have function named show_product()" that displays product id, name,quantity,price and discount information. Your class should have a member function named "calculate_price()". Calculate_price function should calculate the total price considering the quantity, price and discount of the product. In your main program, create array of "Product" objects. Your array size should be 5. Initialize the following objects using the constructor function: Product Id Discount %50 Product Name Mirror Frame Oil Paint Canvas Brush Quantity 1121 Price 10.758.2520.9925.007.99|1010 After you initialize the objects, display the products' information using show_product() function. And display the total price for the products using the member function "calculate_price()". The product's stock information is as follows: Id: 1 Name: Mirror Quantity: 1 Price: $10.75 Discount %:0.5 The total price for the Mirror is : $5.375 The product's stock information is as follows: Id: 2 Name: Frame Quantity: 1 Price: $8.25 Discount %:0 The total price for the Frame is : $8.25 The product's stock information is as follows: Id: 5 Name: Brush Quantity: 5 Price: $7.99 Discount %:0 The total price for the Brush is : $7.99 Object is destroyed. Object is destroyed. Object is destroyed. Object is destroyed. Object is destroyed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!