Basic Operations
Calculator Assignment:
- Create a new file and write the code that will do the following:
- Ask the user to enter two integer numbers (Use while loops to ensure that they are between 1 and 500 or some other range)
- Have the computer calculate and display the following:
- Addition
- Subtraction (2 equations)
- Multiplication
- Division
- Regular Division - float answer (2 equations)
- Integer and Modulus (remainder) division - Integer answers (2 equations) - (Hint: use x%y) ... type casting may be needed
- Square each number
- use x**y such as x**2
- use pow(x, 2)
- Cube each number
- use x**y such as x**3
- use pow(x, 3)
- Consider ways to complicate this program. Here are some possibilities:
- Questions that involve BEDMAS / Order of Operations
- take a number, multiply by three and then add four
- take a number, add four and then multiply by three.
- Enter any base and exponent
- Other operations: square root, cube root, trigonometric functions, factorial, etc._
- Compare the numbers and display whether it is true or false
- Mathematical equations (area, perimeter, volume, etc)
- Try making a calculator.
- Ask for two numbers and then provide a menu that allows the user to decide which of the operations they want to perform.
- Could also provide an "all" option
- What about if they want to do another calculation. Is it with the same two numbers or with different numbers.
- Questions that involve BEDMAS / Order of Operations