Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ In class when we were talking about loop structures, we wrote a menu-driven while loop. We prompted the user to make a choice

image text in transcribedin c++

In class when we were talking about loop structures, we wrote a menu-driven while loop. We prompted the user to make a choice of an item to purchase, with a flag to quit. With each purchase we summed up the bill, and when the user decided to quit, we printed out the final amount owed. I would like you to modify this program so that the menu is displayed and the user choice is gotten and returned from a function. Provide the user with three options of things they can purchase, as well as the price of each item. As in the example from class, when the user is done purchasing items, display the total bill. The basic structure (with many details left out) would be as follows: choice = getChoice(); while(choice != 0) add the latest purchase to the bill choice = getChoice(); In this example, getChoice displays the options and prices) to the user, and then reads in the user's choice. This choice is then returned as the function's return value. The flag to quit is O in the above example

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

Students also viewed these Databases questions

Question

Conduct an effective performance feedback session. page 360

Answered: 1 week ago