Main Task
- Create a basic calculator program that will take two numbers, and perform one of the following functions depending on what the user chooses:
- add
- subtract
- multiply
- divide
- You should assume that all user input will be valid whole numbers. You should ask the user which function they wish to perform. The output should be formatted and laid out appropriately.
- Have the program display an error message and exit if the user attempts to divide by zero
- Save and label your code
Extension Task
- Modify the program so it prints to 2 decimal places
- Modify the program so it checks the input numbers are valid numbers
- Save and label your code
Hints
- It may help to sketch out on paper the order in which you need to perform parts of the program
- You’ll need to cast (convert) inputs to integers
- Think about what input your program requires
- IF/ELIF/ELSE can be used to select different arithmetic operations
- All the required knowledge required for this task is contained in the previous tasks on the website