/Calculator

A java-based console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers

Primary LanguageJava

Calculator

This is a java-based console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers. It was the mid-term project from course 5185 Java Programming for Beginners taught by Bineet Sharma.

This program first displays a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the user selects the operation, it will check for valid menu choices (and give an appropriate message if a wrong choice was selected) and then prompts the user to enter two numbers, separated by a space. If the user enters valid numbers, it will do the operation desired, and then displays the result. If the user enters invalid numbers, it displays an error message and asks for the correct input. After displaying the result, it displays Press enter key to continue. Once enter key is pressed, it displays the menu again. The program repeats until the user selects the choice to exit.