Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you will modify your basic calculator to be a little more user-friendly. Make these modifications: If the user enters an invalid menu

In this assignment, you will modify your basic calculator to be a little more user-friendly. Make these modifications:

  1. If the user enters an invalid menu option, allow them to try again until they enter a valid one.
  2. If the user chooses three invalid menu options in a row, give them a message about trying again later and end the program.
  3. After the user chooses a valid menu option and your program computes and displays the result, you should start over again by displaying the menu. This should continue until the user chooses a Quit menu option.

Here are some example runs of the program:

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number
  6. Quit

What would you like to do? 9

I'm sorry, 9 wasn't one of the options

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number
  6. Quit

What would you like to do? 0

I'm sorry, 0 wasn't one of the options

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number 6. Quit

What would you like to do? 7

I'm sorry, 7 wasn't one of the options

Please try again later.

_____________________________________________________________________________________ Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number
  6. Quit

What would you like to do? 9

I'm sorry, 9 wasn't one of the options

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number 6. Quit

What would you like to do? 0

I'm sorry, 0 wasn't one of the options

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number
  6. Quit

What would you like to do? 1 What is the first number? 3

What is the second number? 4

Answer: 7.0

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number 6. Quit

What would you like to do? 4

What is the first number? 6

What is the second number? 0

I'm sorry, you can't divide by zero.

Answer: NaN

Menu

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Generate random number

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

Question What are the advantages of a written bonus plan?

Answered: 1 week ago