Вы находитесь на странице: 1из 4

Q5.

Define a class TOUR in c++ with the description given below:


4
Private Members:
Tcode

of type string

NoofAdults

of type integer

NoofKids

of type integer

Kilometers

of type integer

Total Fare

of type float

Public Members:
Tcode with the word NULL
NoofAdults as 0
NoofKids as 0
Kilometers as 0
TotalFare as 0

A function AssignFare() which calculates and assigns the value of the data
member TotalFare as follows
For each Adult
Fare(Rs)
500
300
200

For Kilometers
>=1000
<1000 & >=500
<500

For each Kid the above fare will be 50% of the fare mentioned in the above
table for example:
If kilometers is 850, NoofAdults=2,NoofKids=3
Then TotalFare should be calculated as
NumofAdults *300+NoofKids *150
i.e,

2*300+3*150=1050

Q1.

A function EnterTour () to input the values of the data members


Tcode,NoofAdults,NoofKids and Kilometers; and invoke the assignFare()
function.
Afunction show touor() which display the content of all the data members for
a tour.

Write a program to enter elements into a 3X3 matrix, display the entered
elements and also display the diagonal summation of the entered elements.
10

Q25. Write a program to enter name, roll no. of n number s of student and display
names and roll numbers using structure.
5
Q20. Write a program to enter n number into an array and display the sum of the
elements .
5
Q21. Write a program to display first 10 prime numbers.
5
Q22.

Write a program to display the greatest number from an entered array.


5

Q1.

Write a program to enter elements into a 3X3 matrix, display the transpose of
matrix.
5

Q2.

Define a class Garments in C++ with the following descriptions:


5
Private Members:
Gcode

of type string

GType

of type string

Gsize

of type integer

Gfebric

of type string

Gprice

of type float

A function Assign() which calculates and assigns the value of Gprice as


following:
For the value of Gfebric COTTON,
Gtype

Gprice(Rs)

TROUSER

1300

SHIRT

1100

For Gfebric other than COTTON the above mentioned Gprice get
reduces by
10%
Public Members:
A constructor to assign initial values of Gcode, Gtype and Gfebric with
the word NOT ALLOWED and Gsize and Gprice with 0.
A function input() to input the values of the data members Gcode,
Gtype, Gsize and Gfebric and invoke the assign() function .
A function display() which display the content of all the data members
for a Garment.
(c)
4

Define a class named PERCENTAGE in C++ with the following description:


Privet Members:
Name

Array of charecters(string)

Clas

character

Percentage

float

Grade

charecter

Public Members:
Function read_data() to read data members of PERCENTAGE
type.
Function result() to check and store the result in grade(depend
on percentage)
Function Display() to display the details of data members
Q3.

(a)
Write a function in C++ which accepts an integer array and its
size as parameters and rearranges the array in reverse. Example: if
any array of nine elements initially contains the elements as
4,2,5,1,6,7,8,12,10
4
than function rearrange the array as 10,12,8,7,6,1,5,2,4.

(c) Define a class Trevell in


(4)
Private members :
TrevelCode
of
Place
of
No_of_travellers
of
No_of_buses
of

C++ with the following descriptions:


type
type
type
type

long
character array(string)
integer
integer

Public members:
A Constructor to assign initial values of Travelcode as 201,Place as
Nainital, No_of_travellers as 10, No_of_buses as 1
Afunction Newtravel() which allows user to enter travelCode,Place and
No_of _travelers. Also, assign the value of No_of_buses as per the
following conditions:
No_of_travellers
No_of_buses
Less than 20
1
Epual to or more than 20 and less than 40
2
Equal to 40 or more than 40
3
A function ShowTravel() to disply the content from all data members on
screen.

Вам также может понравиться