Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE: CODE MUST BE WRITTEN IN C++ LANGUAGE WITHOUT ANY ERRORS. [5 MARKS 1 Create a program that declares the following three integer variables: opCode
NOTE: CODE MUST BE WRITTEN IN C++ LANGUAGE WITHOUT ANY ERRORS.
[5 MARKS 1 Create a program that declares the following three integer variables: opCode is an integer variable. number_1 is an integer variable initialized to equal the LAST FOUR DIGITS of your STUDENT ID. number_2 is an integer variable initialized to equal 19. Next prompt the user to enter a value for opCode (1, 2, 3, 4, or 5), Next, read the value entered from the keyboard and assign it to opCode: Enter an integer value for opCode (1, 2, 3, 4, or 5): (Enter 1 from the keyboard for the first run) (Enter 2 from the keyboard for the second run) (Enter 3 from the keyboard for the third run) (Enter 4 from the keyboard for the fourth run) (Enter 5 from the keyboard for the fourth run) (Enter 9 from the keyboard for the fourth run) Next create a switch ... case statement that will display the following output: a. For opCode = 1, your code should display: The SUM of number 1 and number_? = xxxxxxx (USING FIELD WIDTH OF 7) b. For opCode = 2, your code should display: The DIFFERENCE of number 1 and number_2 = XXXXXXX (USING FIELD WIDTH OF 7) c. For opCode = 3, your code should display: The PRODUCT of number_1 and number 2 - XXXXXXX (USING FIELD WIDTH OF 7) d. For opCode = 4, your code should display: The QUOTIENT of number_1 and number_2 = **xxxxx (USING FIELD WIDTH OF 7) e. For opCode = 5, your code should display: The MODULUS of number_1 and number_2 = XXXXXXX (USING FIELD WIDTH OF 7) f. For opCode = 9, your code should display: You have entered an INVALID value for opCode The Name, Student ID and Section number that appears in the output of the program should be your own, not the ones used in the sample run. Sample run 1: - Name: Smith, Peter Student ID: 300999999 Section: 001 Enter an integer value for opCode (1, 2, 3, 4, or 5): The SUM of number 1 and number_2 = 1 XXXXXXX Press any key to continue... NOTE: THERE SHOULD BE A TOTAL OF 6 SCREEN SHOTS FOR THIS TASK, ONE FOR EACH VALUE OF opCode. //COPY AND PASTE YOUR WORKING CODE DOWNWARDS FROM HERE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started