Related questions
Concept explainers
(In java) Lab6C: Cha-Ching For this lab, use a do-while loop.
A sentinel loop is a loop (a special while loop or a do-while loop) that continues to process data until it
reaches a specific value(s) that signals that it should stop looping; this special value(s) is usually
indicated as the condition of the while or do-while loop. A good example of a sentinel loop is the while
loop that you had to write to verify user input in Lab6B, the special values were anything in the range of
1 to 1000. Another very common application for this is allowing a user to rerun a program.
Please write a very simple program that mimics a bank account. The program should start the user out
with 1000ドル. The program should print out a welcome menu once with the options present for the user.
The program should allow the user to make a deposit, withdrawal, and see their current balance.
Every time the user deposits or withdraws, the program should show the user their new balance; it
should also ask the user if they want to return to the main menu. As long as the user types ‘Y’ or ‘y’
the program should keep running.
Remember, the class name should be Lab6C.
The user input is indicated in bold.
Sample output:
Welcome!
You have 1000ドル in your account.
Menu
0 – Make a deposit
1 – Make a withdrawal
2 – Display account value
Please make a selection: 1
How much would you like to withdraw? : 50
Your current balance is 950ドル
Would you like to return to the main menu (Y/N)? : Y
Menu
0 – Make a deposit
1 – Make a withdrawal
2 – Display account value
Please make a selection: 0
How much would you like to deposit? : 100
Your current balance is 1050ドル
Would you like to return to the main menu (Y/N)? : Y
Menu
0 – Make a deposit
1 – Make a withdrawal
2 – Display account value
Please make a selection: 500
Invalid entry, please try again.
Would you like to return to the main menu (Y/N)? : Y
Page 6 of 6
Menu
0 – Make a deposit
1 – Make a withdrawal
2 – Display account value
Please make a selection: 2
Your current balance is 1050ドル
Would you like to return to the main menu (Y/N)? : N
Thank you for banking with us!
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- (Use python):The instructor of a lower division statistics class has assigned you a task: make a function that takes in a student’s score on a scale from 0 to 100 and assigns a letter grade based on the following grade boundaries.arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a...arrow_forward[Python Language] A common back-of-the-envelope technique for estimating a runner’s marathon time is to take their best half-marathon time, multiply by two and add ten minutes. This works pretty well unless the marathon course is hilly.If it is hilly, we add an extra 20 minutes to the estimate. Write a program that takes two lines of input: a float giving the half- marathon time in minutes and an integer indicating whether the marathon course is hilly(1) or not (0). It prints a float giving the estimated number of minutes the runner will take to run the full marathon. Write your pro- gram in a file named marathon.py.arrow_forward
- Zybooks C++ 1.7 LAB: Introduction to data structures labs Step 1: Producing correct output Three commented-out lines of code exist in main(). Uncomment the lines and click the "Run program" button. Verify that the program's output is: 2 + 2 = 4 Unknown function: PrintPlus2 Secret string: "abc" Submit your code for grading. Your submission will pass the "Compare output" test only, achieving 1 of the possible 10 points. Step 2: Inspecting the LabPrinter class Inspect the LabPrinter class implemented in the LabPrinter.h file. Access LabPrinter.h by clicking on the orange arrow next to main.cpp at the top of the coding window. Member functions Print2Plus2() and PrintSecret() print strings using std::cout. Step 3: Implementing CallFunctionNamed() Remove the three uncommented lines from main(). Then implement the CallFunctionNamed() function in main.cpp to handle three cases: If functionName is "Print2Plus2", call printer's Print2Plus2() member function. If functionName is "PrintSecret",...arrow_forwardin c++ write a code to return the value of fake coin, the fake coin is The different element of the value in the array ،and need for way solution using 1) brute force approaches 2) divide and conquer 3) decrease and conquer 4) transform and conquer and write the time of each one and what the best time of them. in c++ write a code to return the value of fake coin, the fake coin is The different element of the value in the array and be less value (minimum) , need four way solution using 1) brute force approaches 2)divide and conquer 3)decrease and conquer 4) transform and conquer and write the time of each one and what the best time of them.arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education