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

Hi I was hoping that someone who has a high answer rating above 80% would help m

ID: 3567137 • Letter: H

Question

Hi I was hoping that someone who has a high answer rating above 80% would help me answer this programming problem.

This lab allows students to use variations of the if statement.

?

The following is the code to be used:

// This program prints "You Pass" if a student's average is

// 60 or higher and prints "You Fail" otherwise

#include <iostream>

using namespace std;

int main()

{

float average; // holds the grade average

cout << "Input your average:" << endl;

cin >> average;

if (average > 60) cout << "You Pass" << endl;

if (average < 60) cout << "You Fail" << endl;

return 0;

}

Please highlight the changes you have made to the code and reasoning to earn reward.

Explanation / Answer

please rate - thanks

// This program prints "You Pass" if a student's average is

// 60 or higher and prints "You Fail" otherwise

#include <iostream>

using namespace std;

int main()

{

float average; // holds the grade average

cout << "Input your average:" << endl;

cin >> average;

if (average >= 60) cout << "You Pass" << endl;

if (average < 60) cout << "You Fail" << endl;

return 0;

}

// This program prints "You Pass" if a student's average is

// 60 or higher and prints "You Fail" otherwise

#include <iostream>

using namespace std;

int main()

{

float average; // holds the grade average

cout << "Input your average:" << endl;

cin >> average;

if (average >= 60)
     cout << "You Pass" << endl;
else
     cout << "You Fail" << endl;

return 0;

}

// This program prints "You Pass" if a student's average is

// 60 or higher and prints "You Fail" otherwise

#include <iostream>

using namespace std;

int main()

{

float average; // holds the grade average

cout << "Input your average:" << endl;

cin >> average;
/*since thes categories are mutually exclusive
once 1 is true, it dosen't check any of the others*/

if(average>100)
     cout<<"Invalid Data"<<endl;
else if (average >=90) //only gets here if average <100
     cout<<"A"<<endl;
else if (average >=80) //only gets here if average <90
     cout<<"B"<<endl;   
else if (average >= 60)   //only gets here if average <80
     cout << "You Pass" << endl;
else if(average>=0)       //only gets here if average <60
     cout << "You Fail" << endl;
                            // if average <0, nothing will happen
return 0;

}

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