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!

Recommended Answers

All 2 Replies

Yes, you need to do it. You should also read some of the rules.

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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.