Write a program that allows a customer to purchase multiple items. When the customer is finished with their selections, display the total and accept their payment. Functions: malnO:
• Initialize total to 0 • Use a loop to allow repeated selections: o Call addPurchase(). It should return the amount of the customer’s choice or 0 if the customer is finished o Add the customer’s purchase price to total o Repeat the loop unless addPurchase() returns 0 • Call function prIntTotol(total) to display the total due • Coll function getPayment(total) to collect payment
double addPurchaseo: • Use a loop and repeat until the customer makes a valid selection: o Display a list of at least 4 items for sale with prices o Get the customer’s selection o Use a switch statement to get the amount of the customer’s selection and return the amount or 0 if they want to quit o If the customer makes an invalid selection, show an error message and iterate through the loop again
The post Write a program that allows a customer to purchase appeared first on My Assignment Online.