Question: using Kotlin program Exam 1 Practical Kotlin Console Calculator: Write a Program that displays repeatedly a menu as shown in the sample run below. The

using Kotlin program Exam 1 Practical
Kotlin Console Calculator:
Write a Program that displays repeatedly a menu as shown in the sample run below. The user can
enter 1,2,3,4 or 5 for choosingko addition, subtraction, multiplication, division or exit
respectively.
All the operations handling has to be within a functions.
After an operation is finished and output is displayed the menu is redisplayed, you may choose
another operation or enter 5 to exit the program.
Each operation will ask the user for two numbers then calculate and display the answer.
Handle the division by zero case, by displaying an Error Message if the user is trying to divide
by 0.
Sample run:
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 1
Enter number 1: 5
Enter number 2: 4
The Answer is: 9
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 4
Enter number 1: 8
Enter number 2: 0
Impossible to divide by Zero.
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 5
Exiting...
Thank you for using the C++ Console Calculatorko
Kotlin Console Calculator:
Write a Program that displays repeatedly a menu as shown in the sample run below. The user can
enter 1,2,3,4 or 5 for choosing addition, subtraction, multiplication, division or exit
respectively.
All the operations handling has to be within a functions.
After an operation is finished and output is displayed the menu is redisplayed, you may choose
another operation or enter 5 to exit the program.
Each operation will ask the user for two numbers then calculate and display the answer.
Handle the division by zero case, by displaying an Error Message if the user is trying to divide
by 0.
Sample run:
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 1
Enter number 1: 5
Enter number 2: 4
The Answer is: 9
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 4
Enter number 1: 8
Enter number 2: 0
Impossible to divide by Zero.
Main Menu
1: Addition
2: Subtraction
3: Multiplication
4: Division
5: Exit
Enter a Choice: 5
Exiting...
Thank you for using the C++ Console Calculatorko
 using Kotlin program Exam 1 Practical Kotlin Console Calculator: Write a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!