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 menudriven 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:
Will use an array of function pointers.
Will use a switch statement to select option to Add, subtract, multiply, or divide two double numbers.
Will use four functions, addition function, subtraction function, multiplication function, and division function.
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 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 the decomposition and using stepwise analysis when developing an algorithmpseudo 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:
COSC Lab: Menu Driven Calculator
Programmer: Enter Student Name
Date: Enter date program written
Description: Calculator Using Function Pointers Create a menudriven 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:
Will use four functions, addition function, subtraction function, multiplication function, and division function.
Will use an array of function pointers to point to appropriate function.
Will use a switch statement to select option to Add, subtract, multiply, or divide two double numbers.
Will use toupper function to accept Aa for addition, S s for subtraction, Mm for multiplication, Dd for division.
Place pseudo code here
#include standard input and output library
#include allow access to toupper function
int mainvoid main function code block
ENTER CODE HINT: Use the pseudo code to help document your program.
return ;
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 Reenter a choice
Enter A to add, S to subtract, M to multiply, D to divide, E to end: A
Enter first number to add:
Enter second number to add:
is
Enter A to add, S to subtract, M to multiply, D to divide, E to end: s
Enter first number for subtraction:
Enter second number for subtraction:
is
Enter A to add, S to subtract, M to multiply, D to divide, E to end: D
Enter first number for division:
Enter second number for division:
is
Enter A to add, S to subtract, M to multiply, D to divide, E to end: M
Enter first number for multiplication:
Enter second number for multiplication:
is
Enter A to add, S to subtract, M to multiply, D to divide, E to end: e
Program ended.
Program finished with exit code
Press ENTER to exit console.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
