Writing a function to find the smallest value This program must
have 11 functions: Failure to follow these requirements will result
in a failing grade on the assignment even if it passes all tests:
main() Controls the flow of the program (calls the other modules).
This includes decision logic (such as while True, if/elif/else) to
call functions as requested. userMenu() Displays choices.
userInput() Asks the user to select a menu option. If any menu item
is selected, ask to enter two numbers. Hint: Don't cast the input
to number types. Let inputTest() do that. inputTest() Accepts
values from userInput(). Tests value to make sure it's a number. If
it's not a number, it will ask for a valid number. Returns valid
numbers. add() Accepts two numbers, returns the sum subtract()
Accepts two numbers, returns the difference of the first number
minus the second number multiply() Accepts two numbers, returns the
product divide() Accepts two numbers, returns the quotient of the
first number divided by the second number modulo() Accepts two
numbers, returns the modulo of the first number divided by the
second number exponent() Accepts two numbers, returns the first
number raised to the power of the second number. userOutput() Gives
a user friendly output of the selected calculation. HINT: make your
code reusable so that this method contains no decision structure!
Your program must effectively handle ALL errors. I should see no
"red" program errors while running and testing your code. The
program should not end or quit until the user chooses to quit in
the menu. You should notice that this program's calculations are
similar to a program we covered in class subject reviews and in
another exercise. However, the flow of the program is very
different! To pass the tests, you need to have your output look
like mine, but work with any numbers and selection entered: Select
the action you'd like to take, by number: 1. Add 2. Subtract 3.
Multiply 4. Divide 5. Modulo 6. Exponent Any other number to exit
the program Enter the menu item you would like to run: 4 Enter your
first number: 5 Enter your second number: 3 5.0 / 3.0 =
1.6666666666666667 Select the action you'd like to take, by number:
1. Add 2. Subtract 3. Multiply 4. Divide 5. Modulo 6. Exponent Any
other number to exit the program Enter the menu item you would like
to run: 4 Enter your first number: 5 Enter your second number: 0
5.0 / 0.0 = Divide by 0 Not Allowed Select the action you'd like to
take, by number: 1. Add 2. Subtract 3. Multiply 4. Divide 5. Modulo
6. Exponent Any other number to exit the program Enter the menu
item you would like to run: 5 Enter your first number: 5 Enter your
second number: 0 5.0 % 0.0 = Divide by 0 Not Allowed Select the
action you'd like to take, by number: 1. Add 2. Subtract 3.
Multiply 4. Divide 5. Modulo 6. Exponent Any other number to exit
the program Enter the menu item you would like to run: 7 Program
Exiting
Writing a function to find the smallest value This program must have 11 functions: Failure to follow these requirements
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am