Question: Now that you have the basics, try to implement your own C++ class! Let's say we're building an e-commerce site and you are tasked with
Now that you have the basics, try to implement your own C++ class!
Let's say we're building an e-commerce site and you are tasked with implementing a single-item order in a shopping cart.
Your class should be named ShopItemOrder
.
The item order shall store the following information:
item name;
item unit price;
number of items ordered.
There will be access methods allowing to:
get and set all of the above information;
get the total price for the order;
print the order in a user-friendly way.
You can take any approach to calculating the total price.
class ShopItemOrder
{
// Write your code here
};
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
