Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 again

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Statement Fraud Strategies For Detection And Investigation

Authors: Gerard M. Zack

1st Edition

1118301552, 9781118301555

More Books

Students also viewed these Accounting questions

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago