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

1. Store 10 Students 4 Courses Grade points (0-100). The final Rank (1-4) is sto

ID: 3538022 • Letter: 1

Question

1.    Store 10 Students 4 Courses Grade points (0-100). The final Rank (1-4) is stored in the 5th Column of the 2-D Array. If the Average of all Courses are >=90 the Rank=1 else if >=80 then Rank=2 else is >=60 then Rank=3 else Rank=4.

Count number of Students got Rank1, Rank2, Rank3, and Rank4.

Find the Rank that majority of students got.

Sample run:

Input:

Enter Student Grades

Student 1             74           53           94           94

Student 2             75           72           55           77

Student 3             68           62           57           83

Student 4             70           71           61           81

Student 5             56           87           81           90

Student 6             63           67           10           84

Student 7             99           85           70           74

Student 8             86           87           68           97

Student 9             95           50           88           93

Student 10          65           64           76           99

Students Rank

74           53           94           94           3

75           72           55           77           3

68           62           57           83           3

70           71           61           81           3

56           87           81           90           3

63           67           10           84           4

99           85           70           74           2

86           87           68           97           2

95           50           88           93           2

65           64           76           99           3

Rank Count

Rank 1 0

Rank 2 3

Rank 3 6

Rank 4 1

The Majority Rank is Rank 3

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
int student[10][5];
int rank[4]={0};
for(int i=0; i<10; i++)
{
        for(int j=0; j<4; j++)
        {
                cout << " Enter student " << (i+1) << " Grades Exam " <<(j+1) << " : ";
                cin >> student[i][j];
        }
}
for(int i=0; i<10; i++)
{
double average_grade = static_cast<double> (student[i][0]+student[i][1]+student[i][2]+student[i][3])/4.0;
        if(average_grade>=90)
        student[i][4]=1;
        else if(average_grade>=80)
        student[i][4]=2;
        else if(average_grade>=60)
        student[i][4]=3;
        else student[i][4]=4;
}
for(int i=0; i<10; i++)
{
        rank[(student[i][4])-1]++;
}

cout << "students " << " " << " Rank " << endl;
for(int i=0; i<10; i++)
{
        for(int j=0; j<5; j++)
        cout << student[i][j] << " ";
        cout << endl;
}
cout << " Rank " << " " << " Count " << endl;
for(int k=0; k<4; k++)
{
        cout << "Rank " << (k+1) << " " << rank[k] << endl;
}
int majority =rank[0];
int index = 0;
for(int k=1; k<4; k++)
{
        if(rank[k]>majority)
        {
              majority = rank[k];
              index = k;             
        }
       
}

cout << " The Majority Rank is Rank " << (index+1) << endl;
system("pause");
return 0;
}