SOLVED: A basic calculator

19.99 $

Category:

Description

5/5 - (1 vote)

In this assignment, you will create a basic calculator with a minor twist to keep things interesting. The calculator should be capable of the following operations: • add two numbers • subtract two numbers • multiply two numbers • divide two numbers • generate a random number within a given range. Be careful to ensure that the user does not try to divide by zero. Here are some example runs of the program: Menu 1. Add 2. Subtract 3. Multiply 4. Divide 5. Generate Random Number What would you like to do? 8 I’m sorry, 8 wasn’t one of the options Menu 1. Add 2. Subtract 3. Multiply 4. Divide 5. Generate Random Number What would you like to do? 4 What is the first number? 3 What is the second number? 8 Answer: 0.375 Menu 1. Add 2. Subtract 3. Multiply 4. Divide 5. Generate Random Number 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. Menu 1. Add 2. Subtract 3. Multiply 4. Divide 5. Generate Random Number What would you like to do? 5 What is the lower limit? 10 What is the upper limit? 20 Answer: 15.325396639642719

  • BasicCalculator.zip