0% found this document useful (0 votes)
4 views

Task 10

This lab manual outlines three programming problems related to Object Oriented Programming. Problem 1 involves creating a seat assignment program for a commercial airplane, requiring the use of classes, double pointers, and dynamic memory allocation. Problems 2 and 3 focus on creating student-related classes with constructors, input/output functions, and GPA calculations for undergraduate and graduate students.

Uploaded by

abdurahman saeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Task 10

This lab manual outlines three programming problems related to Object Oriented Programming. Problem 1 involves creating a seat assignment program for a commercial airplane, requiring the use of classes, double pointers, and dynamic memory allocation. Problems 2 and 3 focus on creating student-related classes with constructors, input/output functions, and GPA calculations for undergraduate and graduate students.

Uploaded by

abdurahman saeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Object Oriented Programming

Lab Manual 9

Instructor: Ayesha Liaqat


Email: [email protected]

Department of computer Science

National University of Computer and


Emerging Sciences
PROBLEM NO.1

Write a program that can be used to assign seats for a commercial plane. The airplane has 13 rows, with
six seats in each row. Rows 1 and 2 are first class (seats range: 1-12), Rows 3 through 7 are business
class (seats range: 1-30) and rows 8 through 13 are economy class (seats range: 1-36). Your program
must prompt the user to enter the following information:

1. Ticket Type(first class, business class, or economy class)


2. Desired Seat

Output the seating plan in the following form:

Here * indicates that seat is available and x indicates that seat is occupied.
Make this a menu-driven program, show the user’s choices and allow the user to make appropriate
choices.
Note:
• It is mandatory to implement double pointers and dynamic memory allocation concept in the
program. In other case your work will not be accepted.
• The best approach is to use the concept of classes and objects in the program.
PROBLEM NO.2

Create a class student that contains information about a student’s name,semester,roll no and date of
admission.
Provide
a) A no-argument constructor for initializing the value of data members to some defaults.

b) A 4-argument constructor to initialize the data members sent from the calling function at the
time of creation of an object(date should be sent from outside in the form of a date object).

c) An input function for setting the status of a student

d) A display function to display all the attributes of a student

Now derive a class undergraduate from student class that contains some additional information.
This information is about the semester gpa of a student and the credit points earned per semester
to store this data, provide a 2D array(2*8 array since at maximum there are 8 semesters for an
undergraduate program). One dimension of the array should hold information about the SGPA of
each semester so far and the other dimension should hold the corresponding credit points earned
in that semester.
a) Create a no-argument and a 5-argument constructor for data member initialization.

b) Provide overridden functions for getting and setting the data members

c) Provide another function to calculate the CGPA of the student on the basis of the information
provided by the 2D array.

Derive a class Graduate from student class that has same additional information as the
undergraduate class but in this case, the array is 2*4 sine at maximum there are four semesters in
graduate program. There are two additional data members: one to store the title of the last degree
held and another to store the area of specialization in graduate program. Provide appropriate
constructors and overridden member functions.
PROBLEM NO.3

You might also like