Академический Документы
Профессиональный Документы
Культура Документы
Public Members:
A function Checkin() to allow user to enter values for Rno, Name, Tariff and NOD.
A function Checkout() to display value of all the data members and amount by calling function
CALC().
21 Define a class FLIGHT in C++ with the following description:
Private Members:
Data member FNo of type integer
Data member Destination of type string
Data member Distance of type float
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 less than 2000 1100
>=2000 2200
Public Members:
A function FEEDINFO() to allow user to enter values for FNO , Destination, Distance, Fuel
and call function CALFUEL() to calculate quantity of fuel.
A function SHOWINFO() to display value of all the data members.
22 Consider the following class Coach :
class Coach
{
protected :
int CoachId;
public :
Coach( )
{
CoachId=0;
}
void get()
{ cin>>CoachId;
}
int getId()
{
return CoachId ;
}
};
Write a code in C++ to publically derive another class ‘player’ with the following additional members
derived in the public visibility mode.
Data Members :
PId of type integer
Pname of type string
Score of type int
Member functions :
A default constructor to initialize the data members PId by zero, Pname by NULL(\0) and Score
with 0.
INPUT( ) : To enter PId, Pname and Score
OUTPUT( ) : To display the data members on the screen.
23 Consider the following tables STORE and SUPPLIERS and answer part (i) and (ii) of this
question:
Table : STORE
Item No Item Scode Qty Rate LastBuy
2005 Sharpener Classic 23 60 8 31-Jun-09
2003 Ball Pen 0.25 22 50 25 01-Feb-10
2002 Gel Pen Premium 21 150 12 24-Feb-10
2006 Gel Pen Classic 21 250 20 11-Mar-09
2001 Eraser Small 22 220 6 19-Jan-09
2004 Eraser Big 22 110 8 02-Dec-09
2009 Ball Pen 0.5 21 180 18 03-Nov-09
Table : SUPPLIERS
Scode Sname
21 Premium Stationary
22 Tetra Supply
23 Soft Plastics
(i) Write SQL commands for the following statements :
1. To display detail of all the items in the store table in ascending order of Lastbuy.
2. To display Item No and Item name of those items from store table whose rate is more than 15
rupees.
3. To display the details of those items whose Supplier code(Scode) is 22 or Quantity in store
(Qty) is more than 110 from store table.
4. To display minimum rate of items for each supplier individually as per Scode from table store.
Table : COACHES
SportsPerson Gender CoachID
AJAY M 101
SEEMA F 102
VINOD M 104
TANEJA F 103
(i) Write SQL commands for the following statements :
1) To display all information about swimming coaches in the club.
2) To list the names of all coaches with their date of appointment(DateofApp) in descending order.
3) To display CoachName, Age, Gender and Bonus(15% of pay) for all the coaches.
4) To display the CoachName, SportsPerson from table CLUB and COACHES with their CoachID
(ii) Give the output of the following SQL queries:
1) SELECT COUNT(DISTINCT SPORTS) FROM CLUB;
2) SELECT MIN(AGE) FROM CLUB WHERE GENDER=’F’;
3) SELECT CoachID, CoachName FROM CLUB WHERE PAY BETWEEN 1000 AND 1500;
4) SELECT CoachName, Age, Sports, SportsPerson, Pay FROM CLUB, COACHES WHERE
CLUB.CoachID = COACHES.CoachID AND Pay>1000;