Please Write the Code Its Urgent

Joined
Jul 7, 2008
Messages
1
Reaction score
0
Write a C++ program that contains a class named Student having following data members:



stdId
stdName
stdAge
stdProgram
noOfSubjects.


The class Student must have



· A default constructor which must initialize all the data members to their meaningful values.

· A parameterized constructor which takes values for all the data members as parameters and assign them to their respective fields in class.

· A destructor with no implementation.

· Setter member functions to set all data members (stdId, stdName, stdAge, stdProgram, and noOfSubjects).

· Getter member functions to get all data members (stdId, stdName, stdAge, stdProgram and noOfSubjects).

· Display() member function to display the data for each student.

· Friend function of class that receives an object of type “Student”



Display() member function takes no parameters and displays all the student‘s information on the output screen.



Friend function of class receives an object of type “Student” and determines whether a student has registered in more than five subjects or not.

If a student registers in more than five subjects then it should display a message that “Student has registered in more than 5 subjects” and if a student does not register in more than 5 subjects then it should display a message that “Student has not registered in more than 5 subjects”.



In main function of the program



Dynamically allocate memory for two objects of type “Student”.
Prompt the user to enter data for each student and store into an object of type “Student”.
After setting data for each student, display the data for each student by calling display method.
Determines whether a student has registered more than five subjects or not by calling friend function.
Deallocate memory that was allocated to objects




Sample Output of Program:





Please enter data for student 1



Student ID: std01

Student Name: Sadia

Student Age: 18

Student Program: BCS

Number of Subjects: 3



Please enter data for student 2



Student ID: std02

Student Name: Sidra

Student Age: 17

Student Program: BBA

Number of Subjects: 6



Displaying records for registered students



Record for Student 1



Student ID: std01

Student Name: Sadia

Student Age: 18

Student Program: BCS

Number of Subjects: 3





Record for student 2



Student ID: std02

Student Name: Sidra

Student Age: 17

Student Program: BBA

Number of Subjects: 6



Student 1 has not registered in more than 5 subjects

Student 2 has registered in more than 5 subjects
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top