Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: To create a menu-driven program that allows users to perform basic mathematical operations such as addition, subtraction, multiplication, and division. To use decision-making statements

image text in transcribed
image text in transcribed
image text in transcribed
Objective: To create a menu-driven program that allows users to perform basic mathematical operations such as addition, subtraction, multiplication, and division. To use decision-making statements and functions to determine the user's input perform the corresponding calculation. To use iterations to allow the user to perforn multiple calculations without having to restart the program. Instructions: Create a menu-driven program that allows the user to select from the following options: Addition Subtraction Multiplication Division Apply four operations. Average Exit Use a decision-making statement (e.g., if-else, switch) to determine the user's input and perforn the corresponding calculation. For example, if the user selects "Addition", the program should prompt the user to enter two numbers and then display the result of the addition. Create a function for each mathematical operation (i.e., addition, subtraction, multiplication, and division) to simplify the code and make it more organized. The functions should take two parameters (i.e., the two numbers being operated on) and return the result of the calculation. Apply four operations - should take two parameters and show all the mathematical for each mathematical aperation (1.e., addition, subtraction, multiplication, and division) at once, and show all the results. Calculote average - should take three parameters and find and display the average of those three paraneters. Use an iteration (e.g. while loop) to allow the user to perform multiple calculations without having to restart the program. The program should continue to display the menu of options until the user selects "Exit". The program should also validate user input when they select the operation from the menu, yet you may assume the user enters the numeric input after they select the desired operation. If the user enters an invalid selection, the program should display an error message and prompt the user to enter a valid value. The program should also have to calculate the result as Infinity if the denominator of the division is zero. (e.g., 5/0= infinity) Once the program is complete, test it to ensure that it performs all the calculations correctly and that it handles invalid input and divide by zero errors properly. Submit the program along with the screenshots of the program running and performing the calculations correctly. Grading: Functionality (40\%) Code structure and organization ( 30%) Error handling (20\%) Comments and documentation (10\%) You MUST: - Clearly comment your code (At least with your name and id number). - You must use appropriate variable names. - Print meaningful input and output statements. - Indent you code where necessary. All submissions should at least compile including non-working submissions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is the purpose of a comfort letter? Discuss.

Answered: 1 week ago

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago