Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Folder on your saving location called \"Lab5_YourLastName\" In your Lab

ID: 3813162 • Letter: C

Question

Create a Folder on your saving location called "Lab5_YourLastName" In your Lab5_YourLastName folder, create a C++ Program called Lab5_YourFirstName_YourLastName.cpp Write a console application for the following. Scenario: Create a C++ Program to accept input from the user between the values of 0 to 100 (grades can exceed 100). Output to the user, using "IF" and/or ELSE statements what the entered value calculates to on a Letter grade level. That is, if the number 95.5 is entered, then you will out that this is "An A". Be careful about data types. Should a grade be an int or a double? Professor McMillan, will of course try several values in an attempt to break your implemented code. Think of ways to prevent such items from crashing your program. Add a Multiple line C++ comment to the top of the program with your first name, last name, course name section, Name of Text Editor/software used to create the program, and the a summary of what the program does. Label the Input, Process, and Output sections of the program with C++ Comments. Add appropriate C++ Comments to explain the logic behind your chosen method for solving the problem. Comments are also helpful for the reference of future programmers, and for you. Trace/Test/Run the program using the following data: 92, 61.5, 75.2, 0, 105, -5, 54.5, L, apple, green tea. Save, build and execute your program. Using zip software, Zip the Entire Lab5_YourLastName folder naming the resulting file Lab5_YourLastName.zip

Explanation / Answer

please find the code

please remember this code will Print A F grade for all string entered

/*
First Name
Last Name
Course Name
Section

*/

#include <iostream>

using namespace std;

int main()
{
double d;
cout<<"Enter your grades between 0 and 100"<<endl;
cin>>d;

if((d>90 &&d <=100) || d>100 )
cout<<"An A grade"<<endl;
else if (d>80 &&d <=90)
cout<<"A B grade"<<endl;
else if (d>70 &&d <=80)
cout<<"A D grade"<<endl;
else if (d>60 &&d <=70)
cout<<"An E grade"<<endl;
else
cout<<"A F grade"<<endl;
return 0;
}

second code

/*
First Name
Last Name
Course Name
Section

*/

#include <iostream>

using namespace std;

int main()
{
double d;

   do{
       cout<<"Enter your grades between 0 and 100"<<endl;
       cin>>d;
       if(d==-1)
       {
           cout<<"You have entered Sentinel value"<<endl;
           cout<<"Quiting!!"<<endl;
           break;
       }
       else if((d>90 &&d <=100) || d>100 )
           cout<<"An A grade"<<endl;
       else if (d>80 &&d <=90)
           cout<<"A B grade"<<endl;
       else if (d>70 &&d <=80)
           cout<<"A D grade"<<endl;
       else if (d>60 &&d <=70)
           cout<<"An E grade"<<endl;
       else
           cout<<"A F grade"<<endl;
   }
   while(1==1);
  
   return 0;
}

the above program will quit if the user enters -1 since -1 is the sentinel value to exit from the loop otherwise loop will go into infinite loop