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

This programs needs to calculate all these like hw, test scores extra credit etc

ID: 3643072 • Letter: T

Question

This programs needs to calculate all these like hw, test scores extra credit etc... can someone make me a small mock code in simple c++ on how to calculate the score and put it in range of the scores that cout a, b, c, d, etc.... keep in mind that like if I enter a score for Hw 1 the max is 30 points right and I should not be to cin any # greater than that. But how do I cin all the numbers add them together so that they cout a number to fit with the a,b,c,d,e,f digits. You have to write entire code I just amnot sure if I should use a struct or how to calculate the score.




#include <iostream>
using namespace std;
void getScore(int& score);
void printGrade(int score);

int main ()


{
int courseScore;
int grade;
cout<<"Enter the scores for each assignment " <<endl;
cout<<"HW1: "<<endl;
cin>>grade;
cout<<"HW2: "<<endl;
cin>>grade;
cout<<"HW3: "<<endl;
cin>>grade;
cout<<"HW4: "<<endl;
cin>>grade;
cout<<"HW5: "<<endl;
cin>>grade;
cout<<"HW7: "<<endl;
cin>>grade;

getScore(courseScore); //Line 2
printGrade(courseScore); //Line 3
return 0;
}
void getScore(int& score)


{
cout<<"Line 4: Enter course score--> "; //Line 4
cin>>score; //Line 5
cout<<endl<<"Line 6: Total course score is "
<<score<<endl; //Line 6
}
void printGrade(int score)


{
cout<<"Line 7: Your grade for the course is "; //Line 7
if(score>= 430 ) //Line 8
cout<<"A"<<endl;
else if(score <= 430 && score>= 400 )
cout<<"B"<<endl;
else if(score <=400 && score>= 380 )
cout<<"C"<<endl;
else if(score <=380 && score>=350)
cout<<"D"<<endl;
else
cout<<"F"<<endl;
}

Explanation / Answer

//Since you have not written the exact problem statement. I am posting a sample code. Hope it helps.

//Get the idea. You can do it den.

#include <iostream>

using namespace std;

int main()

{//open main

float hw, ts, ec, total;

//get input

cout<<" HW Marks (max 30)";
cin>>hw;
if (hw > 30)
{cout<<" Enter valid HW Marks (max 30)";
cin>>hw;}

cout<<" Test Marks (max 50)";
cin>>hw;
if (ts > 50)
{cout<<" Enter valid Test Marks (max 50)";
cin>>ts;}

cout<<" Extra Credit Marks (max 20)";
cin>>ec;
if (ec > 20)
{cout<<" Enter valid Extra Credit Marks (max 20)";
cin>>ec;}

total = hw+ts+ec;
cout<<"Total Marks :"<
{
if (total>=80)
{cout<<"Grade : A"<else if (total>=60)
{cout<<"Grade : B"<else if (total>=50)
{cout<<"Grade : C"<else if (total>=40)
{cout<<"Grade : D"<else if (total<40)
{cout<<"Grade : F"<}
system("pause");
}//end main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote