Question: In C coding: (a) Build the ItemToPurchase struct with the following specifications: Data members char itemName [ ] int itemPrice int itemQuantity and create two
In C coding: (a) Build the ItemToPurchase struct with the following specifications: Data members char itemName [ ] int itemPrice int itemQuantity and create two functions - MakeItemBlank() - Has a pass by reference ItemToPurchase parameter. Reference Figure 7.4.1. - Sets item's name = "none", item's price = 0, item's quantity = 0 - PrintItemCost() - Has a pass by value ItemToPurchase parameter.
Example of PrintItemCost() output: Bottled Water 10 @ $1 = $10
(b)In main(), prompt the user for two items and create two objects of the ItemToPurchase struct. Before prompting for the second item, enter fflush(stdin); to allow the user to input a new string.
Example of output: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1
Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10
(c) Add the costs of the two items together and output the total cost.
Example of output: TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10
Total: $13
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
