Write a program that defines a class to keep track of student grades.The information the student class includes are the student’s first name, last name, a six-digit ID number, and a struct marks the struct marks contains five programming assignment scores, a midterm score, a final exam score, and final grade. Your program should assume the students data is stored in a file students.txt The file contains each students info followed by his grades in assignments, midterm and final exam, however the final grade is not provided it must be calculated by your program.
Your class shall contain the following functions. a. a function getData that reads the info from the file and stores them in an array of class student. b.A function clcGrade that assignes a value to the variable grade in struct marks. The Grade can be calculated as follows: Assignments total 10%, midterm 40% , and the final exam is 50%. Students with 90 and above averages earn an A, above 80 earn a B, above 70 earn a C, above 60 earn a D, and all grades below 60 earn an F. Your function should assign the grade to the final Grade variable. Your main function should define an array of students, , calls the function getData, calls the function clcfinal, and finally displays the Results of the students as shown below. here is the definition of the class and the structure you are going to use to solve this question.

struct marks
{
float assignments[5];
float midterm;
float Final;
char grade;
};
class student
{
private:
string Fname;
string Lname;
long ID;
marks m;
public:
student();
student(string="",string="",long=999999);
void setname(string,string);
void setID(long);
void setmark(marks);
void getname(string &,string &);
long getID();
marks getmark();
void display();
};

Note: you have to write the implementation of public member functions.

20060005      EMAN ALI               C
20050002      AHMED ALI            A
ID                   NAME              GRADE

Edited 3 Years Ago by happygeek: fixed formatting

Notes:
 you have to write the implementation of public member functions.
 the function display should display the ID of a student followed by his first and last name followed by his grade.
 the default constructor without parameters should set the id to 111111 and the first and last names to “” .
 the second constructor is a constructor with default parameters .
 the file that contains the students info is provided with the question.
 you can either display students results on the screen or on an output file

can any body help me please i need it before one hour i try to answer and i will show you but it has alot of error

include<iostream>
#include"student.h>
#include<string>
#include<file>
using namespace std;
class student grade
{
private:
float assignments[5];
float midterm;
float Final;
char grade;
public;
void getData(arr[student],instudent,outstudent)
void clcGrade(float,float,float,char)
}
struct marks
{
float assignments;
float midterm;
float Final;
char grade;
};
class student
{
private:
string Fname;
string Lname;
long ID;
marks m;
public:
student();
student(string="",string="",long=999999);
void setname(string,string);
void setID(long);
void setmark(marks);
void getname(string &,string &);
long getID();
marks getmark();
void display();
};
int main()
{
arrstudent[];
ifstream instudent;
outstream outstudent;
instudent.open("student.txt")


if(!instudent)
{
cout<<"error in input file"<<endl;
return 1;
}
outstudent.open("student.txt");
if(!outstream)
{
cout<<"error in output file"<<endl;
return 1;
}
getData(float,float,float,char)
{
assignments=ass;
midterm=mid;
Final=fin;
grade=g;
return instudent;
};


clcGrade(float ass=10,float mid=40,float fin=50,char g)
{
int x=mark.grade;
if(grade>=90)
grade='A';
else if(grade>=80)
grade='B';
else if(grade>=70)
grade='C';
else if(grade='60')
grade='D';
else
grade='F';
}


cout<<ID<<name<<grade;



student ::setname(string,string)
{
Fname=F;
Lname=L;
}
student:: setID(long)
for(int i=0;i<7;i++)
{
ID=arr;
}
student::   setmark(marks)



student::getname(string &,string &)
{
F=Fname;
L=Lname;
}
student:: getID()
arr=ID;
student::   marks getmark()


student:: display()
{
cout<<ID<<name<<grade;
}


return 0;
}

Edited 3 Years Ago by happygeek: fixed formatting

if there is any person to help me jiust email me now please i will fill if i dont do it

i dont think there any body like to help me and i have midterm test after 2 hours i should have a class now but this assigment are diffecult and i will fail his smaster so think you to all because the isnt peson help me

Sorry to say, but you seem to have the very basics of C++ pretty much mixed up.
I'd really suggest you to pick up your text book and take your time to go through it from the beginning.

This article has been dead for over six months. Start a new discussion instead.