Question: Business requirements: ( Calculator Using Function Pointers ) Create a menu - driven program that allows the user to choose whether to add, subtract, multiply

Business requirements: (Calculator Using Function Pointers) Create a menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the user, perform the appropriate calculation and display the result. Use an array of function pointers in which each pointer represents a function that returns void and receives two double parameters. The corresponding functions should each display messages indicating which calculation was performed, the values of the parameters and the result of the calculation. (Note: This is a modified assignment from the book - so the description can only be found here).
Technology requirements:
1. Will use an array of function pointers.
2. Will use a switch statement to select option to Add, subtract, multiply, or divide two double numbers.
3. Will use four functions, addition function, subtraction function, multiplication function, and division function.
5. Pseudo code. Remember the Input, process, output model. Look at what the input should be, what the process is, and what the output should be. Use the code examples in the book and our week 1 lab to understand how to code the input, process, and output. First go into the problem statements above and highlight what needs to be done. Remember chapter 3, the decomposition and using stepwise analysis when developing an algorithm/pseudo code. You will create one array in this program.
Pseudo code: Please submit your pseudocode with your code and screenshots of test cases.
Program Code:
/*
COSC1420 Lab07: Menu Driven Calculator
Programmer: Enter Student Name
Date: Enter date program written
Description: (Calculator Using Function Pointers) Create a menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the user, perform the appropriate calculation and display the result. Use an array of function pointers in which each pointer represents a function that returns void and receives two double parameters. The corresponding functions should each display messages indicating which calculation was performed, the values of the parameters and the result of the calculation.
Technology requirements:
1. Will use four functions, addition function, subtraction function, multiplication function, and division function.
2. Will use an array of function pointers to point to appropriate function.
3. Will use a switch statement to select option to Add, subtract, multiply, or divide two double numbers.
4. Will use toupper() function to accept A,a for addition, S, s for subtraction, M,m for multiplication, D,d for division.
Place pseudo code here
*/
#include // standard input and output library
#include // allow access to toupper function
int main(void)// main function code block
{
ENTER CODE HINT: Use the pseudo code to help document your program.
return 0;
}// end main function
End program
Test Data:
Sample Run
Enter A to add, S to subtract, M to multiply, D to divide, E to end: Q
Value not valid, Please Re-enter a choice
Enter A to add, S to subtract, M to multiply, D to divide, E to end: A
Enter first number to add: 1
Enter second number to add: 2
1.00+2.00 is 3.00
Enter A to add, S to subtract, M to multiply, D to divide, E to end: s
Enter first number for subtraction: 10
Enter second number for subtraction: 5
10.00-5.00 is 5.00
Enter A to add, S to subtract, M to multiply, D to divide, E to end: D
Enter first number for division: 10
Enter second number for division: 5
10.00/5.00 is 2.00
Enter A to add, S to subtract, M to multiply, D to divide, E to end: M
Enter first number for multiplication: 10
Enter second number for multiplication: 20
10.00*20.00 is 200.00
Enter A to add, S to subtract, M to multiply, D to divide, E to end: e
Program ended.
...Program finished with exit code 0
Press ENTER to exit console.

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!