If you could please provide the codes and screenshots (no .doc file) that would
ID: 3557552 • Letter: I
Question
If you could please provide the codes and screenshots (no .doc file) that would be great if not just the codes for each one would be fine many thanks! There should be various codes like 3 or so i think thanks!
This lab lets students work with the switch statement. Copy and paste the code below in a filename LastFirst_lab44.cpp (e.g. DoeJoe_lab44.cpp) and save it in Lab 4 folder, Bring in the LastFirst_lab44.cpp program from the Lab 4 folder. Remove the break statements from each of the cases. What is the effect on the execution of the program? Take a screen shot of the output. Save it in a filename LastFirst_lab44.doc (e.g. DoeJoe_lab44.doc) Add an additional switch statement that allows for a Passing option for a grade of D or better. Use the sample run given below to model your output. Sample Run: What grade did you earn in Programming I ? A YOU PASSED! an A - excellent work! Take a screen shot of the output. Insert it in LastFirst_lab44.doc. Rewrite the program LastFirst_lab44.cpp using if and else if statements rather than a switch statement. Did you use a trailing else in your new version? If so, what did it correspond to in the original program with the switch statement? Take a screen shot of the output. Insert it in LastFirst_lab44.doc. Submit both the revised LastFirst_lab44.cpp and LastFirst_lab44.doc by uploading them here. The following is the code to be used:Explanation / Answer
#include <iostream>
using namespace std; int main()
{
char grade;
cout << "What grade did you earn in Programming I ?" << endl;
cin >> grade;
// This is where the switch statement begins
if(grade=='A')
cout << "an A - excellent work !" << endl;
else if(grade=='B')
cout << "you got a B - good job" << endl;
else if(grade=='C')
cout << "earning a C is satisfactory" << endl;
else if(grade=='D')
cout << "while D is passing, there is a problem" << endl;
else if(grade=='F')
cout << "you failed - better luck next time" << endl;
else
cout << "You did not enter an A, B, C, D, or F" << endl;
return 0;
}