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

ASSIGNMENT IN C++ : Create a Student class which will contain the following: 1)

ID: 665460 • Letter: A

Question

ASSIGNMENT IN C++ :
Create a Student class which will contain the following:
1) A String object to hold a student’s last name
2) An array object to hold five integers representing the student’s grades
3) A method to read in the Student class from a file formatted as: a) Name on one line by itself b) Five integer values for the grades on one line delineated by commas
4) A method to display the students name, grades, and average.
An Array class will be used to hold the collection of Student objects. This Array class will have a method to sort the Student records by name.
Demonstrate the correct working of your classes by reading in a collection of student records from a file, sort the records, and print them. If a name is “EOF” it will mark the end of the file.
There will be a maximum of 25 student records in the file, although it may be less.

Explanation / Answer

#include<conio.h>
#include<iostream.h>
#include<string.h>
class Student
{
private:
int Rollno;
char name[10];
char Grade;
public:
char div;

int std;

student()

{
Rollno=1;
strcpy(name,"Ajay");
Grade='B';
div='C';
std=11;
}
Student(int r,char n[10])
{
Rollno=r;
strcpy(name,n);
Grade='B';
div='C';
std=11;
}
Student(int r,char n[10],char g,char d,int s)
{
Rollno=r;
strcpy(name,n);
Grade=g;
div=d;
std=s;
}
void display()
{
cout<<" Roll Number:"<<Rollno<<endl;
cout<<"name:"<<name<<endl;
cout<<"Grade:"<<Grade<<endl;
cout<<"Division:"<<div<<endl;
cout<<"Standard:"<<std<<endl;
}
};
void main()
{
Student std1(1,"prachi",'A','A',14),std2(2,"raju"),std3;

clrscr();

std1.display();
std2.display();
std3.display();
getch();

}