plz Very important///I will fail that did not help me one

Write a program which contains the following:
a. Class student with the following data members:
 Student ID
 First Name
 Last Name
 Course Name
 First Exam Grade(25%)
 Second Exam Grade(25%)
 5 Assignments’ Grades(Supposing each one out of 10)
 Final Exam Grade(40%)
b. Set functions to fill the previous data members with the information entered by the user.
Name your functions: SetFirstName, SetLastName, SetCourseName, and so on.
c. Get functions to return the information stored in the data members to be displayed in the main function.
Name your functions: GetFirstName, GetLastName, GetCourseName, and so on.
d. Function main which will:
 Contain an Array of class Student.
 Prompt the user to enter the required information.
 Call set functions to fill the data members.
 Call get functions, then display the values returned by the functions.

#pragma once
#include<string>
#include<iostream>
using namespace std;

class Student
{
int id;
string firstName;
string lastName;
string coursName;
double firstExamGrade;
double secondExamGrade;
double finalExamGrade;
double fiveAssGrade;
public:
void setId(int);
int getId();
void setLastName(string);
string getLastName();
void setFirstName(string);
string getFirstName();
void setCoursName(string);
string getCoursName();
void setFirstExamGrade(double);
double getFirstExamGrade();
void setSecondExamGrade(double);
double getSecondExamGrade();
void setFinalExamGrade(double);
double getFinalExamGrade();
void setFiveAssGrade(double);
double getFiveAssGrade();
};

-------------
#include "Student.h"

void Student::setId(int a)
{
id =a;
}
int Student::getId()
{
return id;
}
void Student ::setCoursName(string a)
{
coursName=a;
}
string Student ::getCoursName()
{
return coursName;
}
void Student ::setFirstName(string a)
{
firstName=a;
}
string Student ::getFirstName()
{
return firstName;
}
void Student::setLastName(string a)
{
lastName=a;
}
string Student ::getLastName()
{
return lastName;
}
void Student ::setFirstExamGrade(double a)
{
firstExamGrade =a;
}
double Student::getFirstExamGrade()
{
return firstExamGrade;

}
void Student ::setSecondExamGrade(double a)
{
secondExamGrade=a;
}
double Student ::getSecondExamGrade()
{
return secondExamGrade;
}
void Student::setFinalExamGrade(double a)
{
finalExamGrade=a;
}
double Student::getFinalExamGrade()
{
return finalExamGrade;
}
void Student ::setFiveAssGrade(double a)
{
fiveAssGrade=a;
}
double Student ::getFiveAssGrade()
{
return fiveAssGrade;
}
---------------------
#include<iostream>
#include<string>
#include"Student.h"
using namespace std;
void main()
{
int num;
cout<<"plese insert number of student "<<endl;
cin>>num;
/*Student x[num];
for(int i=1;i<=num;i++)
{ int I;
string F ,L,C;
double RE,SE,FE,A;
cin>>x[i].setId(I);
cin>>x[i].setFirstName(F);
cin>>x[i].setLastName(L);
cin>>x[i].setCoursName(C);
cin>>x[i].firstExamGrade(RE);
cin>>x[i].secondExamGrade(SE);
cin>>x[i].finalExamGrade(FE);
cin>>x[i].fiveAssGrade(A)
}
*/

/*int x[num];
for(int i=1;i<=num;i++)
{





}
*/

}
Last edited on
write the program, and come back when you get some errors so we can help. You deserve to fail if you're coming to this forum expecting us to do your homework for you.
ok man
Sorry, I think your going to fail... Do your homework, read the book, go to class.

change
void main()
to
int main()

change
"---------------------"
to
//---------------------

change
cout<<"plese insert number of student "<<endl;
to
cout<<"please insert number of student "<<endl;



Also all your functions are using "a", your going to kill yourself trying to debug that, although I think it will work.
1
2
3
4
void Student::setId(int a)
void Student ::setCoursName(string a)
void Student ::setFirstName(string a)
void Student::setLastName(string a)


you do not need to set "a" then assign it to the Var
change
void Student ::setCoursName(string a)
to
void Student ::setCoursName(string coursName)

Please use code tags so it indents your code.
Finally, put comments in your code.
Last edited on
SamuelAdams wrote:
change all your functions from
1
2
3
4
5
6
7
8
void Student ::setCoursName(string a)
{
coursName=a;
}
string Student ::getCoursName()
{
return coursName;
}
to something like
1
2
3
4
5
void Student ::setCoursName(string coursName)
{
string Student ::getCoursName()
return coursName;
}
Um, what? Besides the variable name, it was fine before...
SamuelAdams wrote:
Learn to indent your code
When you paste code in the forums without code tags indentation is lost due to HTML processing by your browser and/or message processing done by the forum itself.
Ah tag less, I see, hard to read that way...

Your right, one is setCoursName and one is getCoursName, my bad, I'll remove that.

I was so wrapped around Int a, double a and string a that I think I lost my mind.
Last edited on
Topic archived. No new replies allowed.