0
how to write the code that can go back to the menu when I want?
I am making a calculator program. I want to make people continue to work my math program until they choose to exit back to the main menu, but I don't know how.. and I want my program to display the result (how many correct/incorrect for each type of math program) once the program is exited
2 Respostas
+ 6
Use a loop. Then exit the loop if the user exits the menu.
Rather than a formal loop, I think after you ouput the result of the calculator you should just call the menu function again (That's optional, you could just use a while or do while with a boolean to determine if user wants to exit). So the menu is displayed; for better UI you can use Thread.sleep(x) to add a delay between the menu screen and the result of calculation. Where x * 1000 is seconds to wait.
+ 5
look into finite state machines.