0

I need some help to build the simple code (LAB exercise):

The “main” of the C++ program attached to this assignment expects a class called “item.” This class
must have methods for “enter” and for “print.” Below is a description of what each method should do:
item.enter() should allow the user to enter:
? the item's name
? the item's price
? the item's discount as a percentage of its cost
? the item's category
Note that the discount percentage should not be more than 10% and that the category is limited to
“food,” “clothing” or “other.”
item.print() should print the following in the order specified, all on one line:
? the item's name
? the item's discount percentage
? the tax on the item
? the total cost of the item, taking into consideration its discount percentage and tax
Note that only items in the category “clothing” and “other” are taxed. Items in the category “food” are
not taxed.
Your “main” must look like this:
int main () {
item cart[3];
int i = 0;
while (i < 3) {
cart[i++].enter();
}
i = 0;
cout << "Item: Name price discount tax total" << endl;
while (i < 3) {
cart[i++].print();
}
return 0;
}

THX!

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by squinx22
0

Try to do it by yourself... There are many sample programs in the internet to learn from.. Learn from others work, but dont just depend on it.. Have some fun... You can do it....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.