Nov 16, 2010 at 9:55am UTC
hi,
who can help me for this excersise , pleaseineed help
the quesions says,
1. Write a definition of a class named SudentType, which includes methods and data members as follows:
The data members are:
1. studentId with type integer
2. student fname with the type string
3. Student lname with the type string
4. Array of marks of the max-size equal 36 with the type double (marks[36]),
5. The number of taken courses of the type integer (length).
The studentType class contains the following members functions:
1) default constructor that initialize all members to zeros and spaces.
2) constructor with the parameters where the parameters are student id and the names of the student.
3) setInfo which set the object with student id, fname and lname .
4) insertNew_marks which adds new mark at the end of the list marks and increase length by 1.
5) printStudent which will print the student personal information in one line, followed by all marks that he/she has been taken, ended with Average.
6) Destructor that output the message: "Object has been deleted"
2. write a function named "InsetNewStudent" that insert a new student at the list of type studentType
Note this function is not a member function of the class.
3. Write a main function to test your class.
1) Write one statement to define an array name StudentList with size 10 of objects of the type the class StudentType.
2) Read data (id, fname and lname) of 3 students into array StudentList by calling function
3) Insert 2 marks for each student in the array.
4) Print out all data of all students in StudentList .
Nov 16, 2010 at 10:57am UTC
From the read first post at the top of the forum:
Don't post homework questions
Programmers are good at spotting homework questions; most of us have done them ourselves. Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.
Nov 16, 2010 at 6:12pm UTC
my solution is
#include <iostream>
#include <string>
using namespace std;
class SudentType{
private:
int studentId;
string fname;
string lname ;
double marks[36];
int length;
public:
SudentType(int=0,string ='',string='',double=0.0,int=0);
SudentType(int x, string y, string z);
void setInfo(int,string,string);
void getInfo(int,string,string);
void insertNew_marks(marks l[],length);
void printStudent();
~SudentType();
};
void InsetNewStuden(marks l[],length);
{
for(int i=0; i<length,i++)
please help if you can
Nov 17, 2010 at 10:09am UTC
Almost everybody in this Forum could help you. As what you are asking is for is a problem which only needs little knowledge of a programming language.
But it simple time-consuming for someone to write your homework for you. If you have questions after you tried to program a solution yourself everybody will help you. For example if you have logic error, or your program fails to compile. But only stating your homework here won't help you to learn. And therefore almost no one will help you.
Nov 17, 2010 at 10:38am UTC
ok
can you tell me how i can solve this question:-
printStudent which will print the student personal information in one line, followed by all marks that he/she has been taken, ended with Average.
Nov 17, 2010 at 11:24am UTC
You use a loop to print the marks.
Calculating the average can be done using addition and division.