Write a program that prints all the scenarios where the GPA of a student is 2.5
ID: 3911094 • Letter: W
Question
Write a program that prints all the scenarios where the GPA of a student is 2.5 or above. The student is taking three classes called ‘EGN’, ‘EEL’ and ‘EEE’. The classes have the same number of credits. Below are the possible grades and the corresponding grade-points.
Write a program that prints all the scenarios where the GPA of a student is 2.5 or above. The student is taking three classes called 'EGN', 'EEL' and 'EEE'. The classes have the same number of credits. Below the possible grades and the corresponding grade-points. The program should print all the cases where the student will get a GPA of 2.5 or above. Also, print the number of scenarios found (replace the question mark " in the output below with the actual value). In your program, write and use a function that converts a GP grade (4 to 0) to a letter grade (A to F) Scenarios where GPA 2.5 Number of scenarios: ? EGN EEL EEE GPA A A A4.0Explanation / Answer
//program is written in c++ for given problem
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int count=0,i,j,k;
char grade;
float avg;
cout<<"EGN EEL EEE GPA GRADE ";
cout<<"-------------------------------------- ";
for(i=4;i>=0;i--){
for(j=4;j>=0;j--){
for(k=4;k>=0;k--){
avg=float(i+j+k)/3;
if(avg>=2.5){count++;
cout<<i<<" "<<j<<" "<<k<<" "<<fixed<<setprecision(2)<<avg<<" ";
if(avg==4.0)grade='A';
else if(avg<4.0&&avg>=3.0)grade='B';
else if(avg<3.0&&avg>=2.5)grade='C';
cout<<grade<<" ";
}
}
}
}
cout<<"Total no of senario: "<<count<<" ";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.