Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Programming - Create a program that randomly generates two numbers, then depending on a choice will Add, Subtract, Multiply, or Divide the two numbers.

Python Programming

- Create a program that randomly generates two numbers, then depending on a choice will Add, Subtract, Multiply, or Divide the two numbers.

The program should repeat the entire process until the user decides to quit. At the end display how many times the program repeated and how many correct answers were provided.

How to prevent division by zero generate two numbers if the second number is zero you can add 1 to it for this exercise. NOTE: you can divide into 0, but not by 0, so we are not worried about num1 being a zero.

How to prevent negative subtraction results; IF the second number is larger than the first number: int temp = num1; num1 = num2; num2 = temp;

How to only get whole numbers from division: do Not show problem until you do the next line int newDividend = num1 * num2 now you can use newDividend to divide num 1 into and...of course, the answer is now equal to num2...

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

Students also viewed these Databases questions

Question

Why are ratios and trends used in financial analysis?

Answered: 1 week ago

Question

How do you think these files can be used for data analysis?

Answered: 1 week ago