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

Program Statement

The document outlines a series of programming tasks that involve creating various classes in C++. Each task specifies the data members and member functions required for classes such as Distance, TIME, Person, Employee, Student, batsman, TEST, and Flight, along with instructions for inputting and displaying data. The tasks emphasize object-oriented programming principles and the use of member functions to manipulate and present data effectively.

Uploaded by

muhammad uzair
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Program Statement

The document outlines a series of programming tasks that involve creating various classes in C++. Each task specifies the data members and member functions required for classes such as Distance, TIME, Person, Employee, Student, batsman, TEST, and Flight, along with instructions for inputting and displaying data. The tasks emphasize object-oriented programming principles and the use of member functions to manipulate and present data effectively.

Uploaded by

muhammad uzair
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Question 2 Create a class named Distance that has feets (as int) and inches (as float).

The
class has Getdist (int, float) to get the specified value in object, Showdist () to display
distance object in feets’ inches” format. Write main () function to create two distance
objects. Get the value in two objects and display all objects.

Question 3 Create a class named TIME that has hours, minutes and seconds data members
as integer. The class has settime (int, int, int) to set the specified value in object, showtime
() to display time object in hh:mm:ss format. Write main () function to create two time
objects. Set the value in two objects and display all time objects.

Question 4 Create a class Person that has three data members Pid, Pname, PSalary with
appropriate data type. Person class also contains the member functions: getdata() function is
used to input values, showdata() function is used to display value, setdata() function is used
to set the values of data members using parameters, getSalary() function is used to return the
value of person salary. The program should create three objects of the person class and input
values for these objects. The program display the details of highest salary holder person.

Question 5 Write a class Employee with three data members Eid type int, Ename type string
and Esalary type double. It also contains the following member function:
• The get() function is used to input values
• The show() function is used to display values
• The set() function is used to set the values of data members using parameters
• The returnSalary() function is used to return the salary of employee.
The program should create two object of the employee class, input the values and display the
record of that employee whose monthly salary is greater.

Question 6 Write a program that declare a class Student with five data members to store five
subject mark of student. Class also includes three member function for input marks, Sum() to
calculate and return the sum of five subject and Avg() to calculate and return the average
marks of five subject. Each subject has a maximum of 100 marks. Use this class in your
program.

Question 7 Define a class student with the following specification


Private members of class student
admno integer
sname 20 character
eng. math, science float
total float
ctotal() a function to calculate eng + math + science with float
return type.
Public member function of class student
Takedata() Function to accept values for admno, sname, eng,
science
and invoke ctotal() to calculate total.
Showdata() Function to display all the data members on the screen.

Question 8 Define a class batsman with the following


specifications:
Private members:
bcode 4 digits code number
bname 20 characters
innings, notout, runs integer type
batavg it is calculated according to the formula
batavg =runs/(innings-notout)
calcavg() Function to compute batavg
Public members:
readdata() Function to accept value from bcode, name, innings,
notout and invoke the function calcavg()
displaydata() Function to display the data members on the screen.

Question 9 Define a class TEST in C++ with following


description:
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers
as
(NoCandidates/100+1)
Public Members
- A function SCHEDULE() to allow user to enter values for TestCode,
Description, NoCandidate & call function CALCNTR() to calculate the
number of Centres
- A function DISPTEST() to allow user to view the content of all the data
members

Question 10 Define a class Flight in C++ with following


description:
Private Members
A data member Flight number of type integer
A data member Destination of type string
A data member Distance of type float
A data member Fuel of type float
A member function CALFUEL() to calculate the value of Fuel as per the
following criteria
Distance Fuel
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200
Public Members
A function FEEDINFO() to allow user to enter values for Flight Number,
Destination, Distance & call function CALFUEL() to calculate the quantity of
Fuel
A function SHOWINFO() to allow user to view the content of all the data
members

You might also like