Hi, I'm confused about an assignment. I'm not sure what to do and would like some help.
An example:
Write a program that obtains two integer numbers from the user.
It will print out the sum of those numbers.
Pseudo code:
Prompt user to enter first integer number
Validate user entry is an integer number
If Not an Integer entry, ask user to reenter first integer number
Prompt user to enter second integer number
Validate user entry is an integer number
If Not an Integer entry, ask user to reenter second integer number
Compute sum by adding first integer to second integer number
Display sum of two integer numbers as final result
In this project, create the pseudo code from the following request.
The Pseudo Code must have some sort of menu that allows users to make selections to do a particular calculation such as addition, multiplication, and subtraction
It must provide five menu items that allow the user to make a calculation. Each of the 5 menu items should perform different calculations such as addition, multiplication, and subtraction. There should be an additional menu item for user to exit the program. So, total of 6 menu item.
The Pseudo Code must allow user to enter valid number entries to perform selected calculation option
Once the user selects a menu item, Pseudo Code should perform user entries, calculation, display the result to the user, and return to the main menu. User should be presented with main menu until they choose option to exit the program.
For additional reference and guidelines visit this link.
Please note that this is not a programming assignment. Please do not submit working program as part of the project.
How do I begin?
2 answers
create an int or char called menuchoice
Have variables (int or char) from 1-6 or A-F as your menu option
After you coded your menu, let your user enter their 2 numbers. So create 2 for int variables (num1,num2).
now either use if,then statements or switch-case.
if (menuchoice == 1) {
num1 + num2}
[print answer]
};
else if (menuchoice == 2) {
num1 - num2;
[print answer]
};
--------
keep going until all conditions are coded.
Since he wants you to display the menu again after a condition is done, put all the if-else or switch-case in a do while loop.
do {
[code]
} while false
else if (menuchoice == 6){
[code to quit program]
};
-everything should be in the do while loop except all your variables
-while loop could be used as well
Note: never learned syntax for python but this is the rough layout of what your program should look like.
hope this helps :^)