Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > General Computer Support > Please Help Its urgent C++ Code required

Reply
Thread Tools

Please Help Its urgent C++ Code required

 
 
ch_mshahid ch_mshahid is offline
Junior Member
Join Date: Jul 2008
Posts: 3
 
      07-07-2008
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
 
Reply With Quote
 
 
 
 
jcas1411 jcas1411 is offline
Junior Member
Join Date: Jul 2008
Posts: 5
 
      07-31-2008
Sounds like a homework assignment, need to do this yourself or change fields!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 14 04-03-2010 10:08 AM
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 0 04-01-2010 10:25 PM
Its a bird, its a plane, no ummm, its a Ruide thunk Ruby 1 03-30-2010 11:10 AM
Please Write the Code Its Urgent ch_mshahid C++ 0 07-07-2008 12:13 PM
Please! Help me with this problem (Its urgent for my project) Fazal XML 9 02-12-2006 05:40 AM



Advertisments