# Project.Code.002.004: Designing A Grading System

• Design A Grading System

Requires:

• variables, data types, and numerical operators
• basic input/output
• logic (if statements, switch statements)

1. Design a class that allows the user to enter the grade scored in a programming class (0-100).
2. If the user scored a 100 then notify the user that they got a perfect score.
3. Modify the program so that if the user scored a 90-100 it informs the user that they scored an A
4. Modify the program so that it will notify the user of their letter grade

0-59 F 60-69 D 70-79 C 80-89 B 90-100 A

• class student
{
int rollno;
char name[50];
int p_marks;
double per;
char grade;
void calculate(); //to calculate grade
public:
void getdata(); // data from user
void showdata(); //show data on screen
void show_tabular();
int retrollno();
};

void student::calculate()
{
per=(p_marks)/1.0;
if(per>=90)
grade='A';
else if(per>=80 && per<=89)
grade='B';
else if(per>=70 && per<= 79)
grade='C';
else if(per>=60 && per<= 69)
grade='D';
else
grade='F';
}

• void student::getdata()
{
cout<<"\nEnter The roll number of student ";
cin>>rollno;
cout<<"\n\nEnter The Name of student ";
cin.ignore();
cin.getline(name,50);
}
• void student::showdata()
{
cout<<"Roll number of student : "<<rollno;
cout<<"Name of student : "<<name;
cout<<"Percentage of student is  :"<<per;
cout<<"Grade of student is :"<<grade;
}

• int main()
{
char ch;
do
{
cout<<"\tMAIN MENU";
cout<<"\t01. RESULT MENU";
cout<<"\t02. ENTRY/EDIT MENU";
cout<<"\t03. EXIT";
cout<<"\tPlease Select Your Option (1-3) ";
cin>>ch;
switch(ch)
{
case '1': result();
break;
case '2':  break;
case '3':
break;
default :cout<<"\a";
}
}while(ch!='3');
return 0;
}