Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ Your program should work like an ATM machine that will repeatedly display a menu of options, ask the user to enter a character

Use C++

image text in transcribed

Your program should work like an ATM machine that will repeatedly display a menu of options, ask the user to enter a character to select one of the options, and serve the user according to the option the user has selected until the user says he/she wants to quit the program. In the beginning of your main function, you should (i) declare a variable of char type, for example char opti, to store the character the user entered for the user's choice of options, ) declare a variable of bool type, for example bool isInService, to indicate whether the ATM-like program should sl be actively in service, Initialize isInService to true in the beginning. Your main function should then set up a while loop that will do the things described below on each iteration of the loop and the loop will continue as long as the Boolean variable islnService is true Display a menu of three options L (to tell whether a given year is a leap year), D (to convert a given distance in miles into one in kilometers), and Q (to quit) Prompt the user to choose one of the options by entering the corresponding character (L, 'D, or 'Q), and your program should then read the input character into the corresponding char variable option If the user input is the character 'L', ask the user to provide a year and then tell the user whether it is a leap year If the user input is the character D', ask the user to provide a distance in miles and then tel the user the corresponding distance in kilometers If the user input is the character 'Q, display a message to thank the user for using the program and say goodbye. And then set the value of isInService to false to end the while loop If the user input is none of the three characters L', D', or Q' display a message to tell the user it is an unknown option that the program cannot do anything to help

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

Repeat Problem 21.100 for the case where sheet B is positive.

Answered: 1 week ago

Question

Produce speeches and presentations

Answered: 1 week ago