Answer to Question #279885 in C++ for Leni Lugaw

Question #279885

Create the program in c++ to compute your final grade in quiz, online laboratory, exam 1, exam 2, and exam 3 with your name and section

1
Expert's answer
2021-12-16T04:50:35-0500
#include<iostream>
using namespace std;
int main(){
string name, section;
int quiz, onlineLab, exam1, exam2, exam3, year, average;
cout<<"\nEnter your name: ";
getline(cin, name);
cout<<"\nEnter your section e.g. Information technology: ";
getline(cin, section);
cout<<"\nEnter your year of study e.g. 1: ";
cin>>year;
cout<<"\nEnter your score in the quiz (out of 100): ";
cin>>quiz;
cout<<"\nEnter your score in the online Laboratory (out of 100): ";
cin>>onlineLab;
cout<<"\nEnter your score in the exam 1 (out of 100): ";
cin>>exam1;
cout<<"\nEnter your score in the exam 2 (out of 100): ";
cin>>exam2;
cout<<"\nEnter your score in the exam 3 (out of 100): ";
cin>>exam3;
average=(quiz+onlineLab+exam1+exam2+exam3)/5;
cout<<"\nName      : "<<name;
cout<<"\nSection   : "<<section;
cout<<"\nYear      : "<<year;
cout<<"\nYour average score is : "<<average;
if(average>=70 && average<100){	
	cout<<"\nGrade A";
}
else if(average>=60 && average<70){
	cout<<"\nGrade B";
}
else if(average>=50 && average<60){
	cout<<"\nGrade C";
}
else if(average>=40 && average<50){
	cout<<"\nGrade D";
}
else{	
	cout<<"\nFail";
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog