Your task is to create a functional calculator that can perform basic arithmetic operations based off the
Question:
Your task is to create a functional calculator that can perform basic arithmetic operations based off the user's requests.
Run-through
The program will first ask the user to enter their name. They will then be prompted with a menu of options to choose from and the only way the program terminates is if the user types 'D'. This menu must contain a total of four options the user can choose from; ask the user to perform a modulus operation, division operation and exponential operation (must utilize the math library function for this one). Each arithmetic operation being performed must be within their own respective functions and must return the resultant (final number). The last option they choose will be to terminate the program. If the user does not terminate the program, the program will continue to perform arithmetic operations based off the user's selection. This means you must use a loop (whichever allows you to run the code infinitely).
You do not need to create a function to terminate the loop - it [the loop] should be done in the main body of the code. Your menu should be outputted identically like below (indentation not required):
*** [Your Name]'s Arithmetic Calculator ***
To begin, type the letter corresponding to the option you wish perform.
- Perform Modulus Operation
- Perform Division Operation
- Perform Exponential Operation
- Quit program
Assume the user is always going enter the prompt perfectly. For example, if they wish to perform a division operation, they will only type the letter 'B' in capital. Your code will then make the corresponding function call, the function will execute and return a value back to your main code.
Function Requirements
The modulus and division function will take no arguments - you will ask the user for the number(s) via a prompt inside the function itself. You will then return the resultant back to your main code and print there (NOT IN THE FUNCTION).
The exponential function will take two arguments which means you will ask the user for two numbers in your main code. You will then pass these two numbers as arguments to this function, perform the calculation and return the resultant to your main code. Print this result inside your main code.
To make things simple, all numbers will use integers, not floating points.
Once the user is done performing calculations and decides to quit, the program will terminate and output "Thank you for using my program".
Management Science The Art of Modeling with Spreadsheets
ISBN: 978-1118582695
4th edition
Authors: Stephen G. Powell, Kenneth R. Baker