Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Starting Out with C++ From Control Structures through Objects, Tony Gaddis, 9th edition, ISBN 978- 0134498379 check all lines of the program must run in
Starting Out with C++ From Control Structures through Objects, Tony Gaddis, 9th edition, ISBN 978- 0134498379
check all lines of the program must run in visual studio 2019 thank you
core 1436 P5 Functions 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: main(): 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 O if the customer is finished o Add the customer's purchase price to total o Repeat the loop unless addPurchase() returns 0 Call function printTotal(total) to display the total due Call function getPayment(total) to collect payment double addPurchase(): 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 O if they want to quit o If the customer makes an invalid selection, show an error message and iterate through the loop again void printTotal(double total): Use neatly formatted output to show the customer's final total void getPayment(double total): Use a loop and repeat until the customer pays enough: Ask the customer for payment o Compute the change due o If they do not pay enough, display an error message and iterate through the loop again core 1436 P5 Functions 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: main(): 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 O if the customer is finished o Add the customer's purchase price to total o Repeat the loop unless addPurchase() returns 0 Call function printTotal(total) to display the total due Call function getPayment(total) to collect payment double addPurchase(): 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 O if they want to quit o If the customer makes an invalid selection, show an error message and iterate through the loop again void printTotal(double total): Use neatly formatted output to show the customer's final total void getPayment(double total): Use a loop and repeat until the customer pays enough: Ask the customer for payment o Compute the change due o If they do not pay enough, display an error message and iterate through the loop againStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started