The document defines two C++ classes:
1. ADMISSION class with private data members for admission number, name, class, and fees. It has public member functions to read, display, and randomly select admission details.
2. HOUSING class with private data members for registration number, name, type, and cost. It has public member functions to read housing details, display them, and randomly select and display housing details.
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...Philip Schwarz
Learn how to write FP code that displays a graphical representation of all the numerous N-Queens solutions for N=4,5,6,7,8 .
See how to neatly solve the problem by exploiting its self-similarity and using a divide and conquer approach.
Make light work of assembling multiple images into a whole, by exploiting Doodle’s facilities for combining images using a relative layout.
See relevant FP functions, like Foldable’s intercalate and intersperse, in action.
Code for part 3: https://github.com/philipschwarz/n-queens-combinatorial-problem-scala-part-3
Download for flawless quality (slides viewed online look a bit grainy and out of focus).
Equivalence of nested flatMaps and chained flatMaps for Kleisli arrow composition.
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...Philip Schwarz
Learn how to write FP code that displays a graphical representation of all the numerous N-Queens solutions for N=4,5,6,7,8 .
See how to neatly solve the problem by exploiting its self-similarity and using a divide and conquer approach.
Make light work of assembling multiple images into a whole, by exploiting Doodle’s facilities for combining images using a relative layout.
See relevant FP functions, like Foldable’s intercalate and intersperse, in action.
Code for part 3: https://github.com/philipschwarz/n-queens-combinatorial-problem-scala-part-3
Download for flawless quality (slides viewed online look a bit grainy and out of focus).
Equivalence of nested flatMaps and chained flatMaps for Kleisli arrow composition.
Very quick introduction to the language R. It talks about basic data structures, data manipulation steps, plots, control structures etc. Enough material to get you started in R.
Download for flawless quality (slides viewed online look a bit grainy and out of focus). A monad is an implementation of one of the minimal sets of monadic combinators, satisfying the laws of associativity and identity - see how compositional responsibilities are distributed in each combinator set
This is the last slide of advancedC - Advanced C part 3. In the previous slides we learnt all the fundamentals that is required to learnt Advanced C. In this last slide of Advanced C you will be learning about Multilevel pointers, Command line argument, different kinds of functions, and also you will gain deep knowledge on pre processor and user defined data types. This will help you to improve your knowledge in Advanced C
COURSE TITLE: SOFTWARE DEVELOPMENT VI
COURSE CODE: VIT 351
TOPICS COVERED:
ARRAYS
TYPES OF ARRAYS
MULTIDIMENSIONAL ARRAYS
CHARACTER HANDLING IN C
STRING HANDLING IN C
QUIZ SET 2
Very quick introduction to the language R. It talks about basic data structures, data manipulation steps, plots, control structures etc. Enough material to get you started in R.
Download for flawless quality (slides viewed online look a bit grainy and out of focus). A monad is an implementation of one of the minimal sets of monadic combinators, satisfying the laws of associativity and identity - see how compositional responsibilities are distributed in each combinator set
This is the last slide of advancedC - Advanced C part 3. In the previous slides we learnt all the fundamentals that is required to learnt Advanced C. In this last slide of Advanced C you will be learning about Multilevel pointers, Command line argument, different kinds of functions, and also you will gain deep knowledge on pre processor and user defined data types. This will help you to improve your knowledge in Advanced C
COURSE TITLE: SOFTWARE DEVELOPMENT VI
COURSE CODE: VIT 351
TOPICS COVERED:
ARRAYS
TYPES OF ARRAYS
MULTIDIMENSIONAL ARRAYS
CHARACTER HANDLING IN C
STRING HANDLING IN C
QUIZ SET 2
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2. (c) Define a class named ADMISSION in C++ with the
following descriptions :
Delhi 2006 4
Private members :
AD_NO integer (Ranges 10 - 2000)
NAME Array of characters(String)
CLASS Character
FEES Float
Public Members :
• Function Read_Data( ) to read an object of
ADMISSION type
• Function Display( ) to display the details of an object
• Function Draw-Nos( ) to choose 2 students randomly.
And display the details. Use random function to
generate admission nos. to match with AD_NO.
3. (c) class ADMISSION
{
int AD_NO;
char NAME[20]; //or any constant size
char CLASS;
float FEES;
public:
void Read_Data()
{
do
{
cin>>AD_NO;
}while (AD_NO<10 || AD_NO>2000);
5. void Draw_Nos();
};
(1 mark for proper syntax of class definition
with correct class name and a semicolon to
end the class definition)
(1 mark for proper declaration of private
members)
(1 mark for proper definition of Read_Data())
(1 mark for proper definition of Display())
Note: No marks should be deducted for
Not checking the range for AD_NO Not
declaring or defining Draw_Nos(). (Mentioned
as Draw- Nos() in the question paper)
6. (c) Define a class named HOUSING in C++
with the following descriptions :
Outside Delhi 2006 4
Private members
REG_NO integer(Ranges 10 - 1000)
NAME Array of characters(String)
TYPE Character
COST Float
7. (c) Define a class named HOUSING in C++
with the following descriptions :
Outside Delhi 2006 4
Public Members
• Function Read_Data() to read an object of
HOUSING type
• Function Display() to display the details of an
object
• Function Draw_Nos()to choose and display
the details of 2 houses selected randomly
from an array of 10 objects of type HOUSING.
Use
random function to generate the registration
10. (c)
void HOUSING::Draw_Nos();//Ignore
(1/2 mark for proper syntax of class
definition with correct class name and a
semicolon to end the class definition)
(1/2 mark for mentioning the proper
visibility modes (private / public))
(1 mark for proper declaration of private
data members)
11. (1 mark for proper definition of Read_Data() with
user entry for data members OR declaring a local
object and entering the values of data members of
this object )
(1 mark for proper definition of Display())
Note: As language of Third part of this question
has ambiguity, it is required to be ignored.
Moreover, if anyone has partially attempted the
third part (i.e., Draw_nos function) and not
attempted/not correctly
attempted Read/Display function, he/she should
be given 2 Marks for Third part taking into
consideration the marks for this question should
not exceed the max. marks allocated (i.e. 4 marks)
to this question 2 (c).
12. (c) Define a class Travel in C++ with the
description given below :
Delhi 2007 4
Private Members :
T_Code of type string
No_of_Adults of type integer
No_of_Children of type integer
Distance of type integer
TotalFare of type float
13. (c) Define a class Travel in C++ with the
description given below :
Delhi 2007 4
Public Members :
• A constructor to assign initial values as
follows :
T_Code with the word “NULL”
No_of_Adults as 0
No_of_Children as 0
Distance as 0
TotalFare as 0
14. (c) Define a class Travel in C++ with the
description given below :
Delhi 2007 4
• A function AssignFare( ) which calculates
and assigns the value
of the data member TotalFare as follows :
For each Adult
Fare (Rs) For Distance (Km)
500 >=1000
300 <1000 & >=500
200 <500
15. (c) Define a class Travel in C++ with the
description given below :
Delhi 2007 4
For each Child the above Fare will be 50%
of the Fare mentioned in the above table.
For example :
If Distance is 750, No_of_Adults = 3 and
No_of_Children = 2
Then TotalFare should be calculated as
No_of_Adults * 300 + No_of_Children * 150
i.e. 3 * 300 + 2 * 150 = 1200
16. (c) Define a class Travel in C++ with the
description given below :
Delhi 2007 4
• A function EnterTraveK ( ) to input the values
of the data members
T_Code, No_of_Adults, No_of_Children and
Distance; and
invoke the AssignFare( ) function.
• A function ShowTraveK) which displays the
content of all the
data members for a Travel.
17. (c) class Travel
{
char TCode[5]; //OR char *Tcode;
int No_of_Adults;
int No_of_Children;
int Distance;
float TotalFare;
public:
Travel();
void AssignFare();
void EnterTravel();
void ShowTravel();
};
21. (½ Mark for correct syntax of class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of
constructor)
(1 Mark for checking all three conditions
and calculating TotalFare in AssignFare( ))
(½ Mark for correct EnterTravel( ) with
proper invocation of AssignFare( ))
(½ Mark for displaying all data Members
including TotalFare inside ShowTravel( ))
22. (c) Define a class Tour in C++ with the
description given below :
Outside Delhi 2007 4
Private Members :
TCode of type string
NoofAdults of type integer
NoofKids of type integer
Kilometres of type integer
TotalFare of type float
23. (c) Define a class Tour in C++ with the
description given below :
Outside Delhi 2007 4
Public Members :
• A constructor to assign initial values as
follows :
TCode with the word “NULL”
NoofAdults as 0
NoofKids as 0
Kilometres as 0
TotalFare as 0
24. (c) Define a class Tour in C++ with the
description given below :
Outside Delhi 2007 4
• A function AssignFare ( ) which calculates
and assigns the value of
the data member TotalFare as follows
For each Adult
Fare(Rs) For Kilometres
500 >=1000
300 <1000&>=500
200 <500
25. (c) Define a class Tour in C++ with the
description given below :
Outside Delhi 2007 4
For each Kid the above Fare will be 50% of
the Fare mentioned in the
above table
For example :
If Kilometres is 850, NoofAdults = 2 and
NoofKids = 3
Then TotalFare should be calculated as
NumofAdults * 300 + NoofKids * 150
i.e. 2*300 + 3*150=1050
26. (c) Define a class Tour in C++ with the
description given below :
Outside Delhi 2007 4
• A function EnterTour( ) to input the values of
the data members
TCode, NoofAdults, NoofKids and Kilometres;
and invoke the
Assign Fare( ) function.
• A function ShowTour( ) which displays the
content of all the data
members for a Tour.
27. (c) class Tour
{
char TCode[10]; //OR char *Tcode;
int NoofAdults;
int NoofKids;
int Kilometres;
float TotalFare;
public:
Tour()
{
strcpy(TCode,”NULL”); //OR TCode[0]=’0’OR
strcpy(TCode,”0”)
28. //OR TCode=NULL if TCode is declared as
char pointer
NoofAdults = 0;
NoofKids = 0;
Kilometres = 0;
TotalFare = 0;
}
void AssignFare();
void EnterTour();
void ShowTour();
};
31. (½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of constructor)
(½ Mark for condition checking in
AssigFare())
(½ Mark for calculation of correct TotalFare
for each condition)
(½ Mark for correct EnterTour() with proper
invocation of AssignFare())
(½ Mark for displaying all data Members
including TotalFare inside ShowTour())
32. (c) Define a class Garments in C++ with the
following descriptions:
Delhi 2008 4
Private Members:
GCode of type string
GType of type string
GSize of type integer
GFabric of type string
GPrice of type float
A function Assign ( ) which calculates and
assigns the value of GPrice as follows
33. (c) Define a class Garments in C++ with the
following descriptions:
Delhi 2008 4
For the value of GFabric as “COTTON”,
GType GPrice(Rs)
TROUSER 1300
SHIRT 1100
For GFabric other than “COTTON” the above
mentioned GPrice gets reduced by 10%.
34. (c) Define a class Garments in C++ with the
following descriptions:
Delhi 2008 4
Public Members:
A constructor to assign initial values of GCode,
GType and GFabric with the word “NOT
ALLOTTED” and GSize and GPrice with 0
A function Input ( ) to input the values of the
data members GCode,
GType, GSize and GFabric and invoke the
Assign ( ) function.
A function Display ( ) which displays the
content of all the data members for a Garment.
37. void Garments::Assign( )
{
if (strcmp(GFabric,“COTTON”)==0)
//if (!strcmp(GFabric, “COTTON”))
{
if (strcmp(GType,“TROUSER”) ==0)
GPrice=1300;
else if (strcmp(GType,“SHIRT”)==0)
GPrice=1100;
}
38. else
{
if (strcmp(GType,”TROUSER”) = =0)
GPrice=1300*0.9; // 10% reduction
else if (strcmp(GType,“SHIRT”)= =0)
GPrice=1100*0.9; // 10% reduction
}
}
void Garments::Input( )
{
gets(GCode) ; // or cin >> GCode;
gets(GType) ; // or cin >> GType;
cin>>Gsize;
39. gets(GFabric) ;// or cin >> GFabric;
Assign( ) ;
}
void Garments::Display( )
{
cout<<GCode<<GType<<GSize<<GFabric<<G
Price<<endl;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(½ Mark for correct definition of
constructor)
40. (1 Mark for correct definition of Assign( ))
(1 Mark for correct definition of Input( ) with
proper invocation of Assign( ) function)
(½ Mark for correct definition of Display( ))
NOTE:
Deduct % Mark if Assign( ) is not invoked
properly inside Input( ) function
41. (c) Define a class Clothing in C++ with the
following descriptions:
Outside Delhi 2008 4
Private Members:
Code of type string
Type of type string
Size of type integer
Material of type string
Price of type float
A function Calc_Price( ) which calculates and
assigns the value of Price as follows:
42. (c) Define a class Clothing in C++ with the
following descriptions:
Outside Delhi 2008 4
For the value of Material as “COTTON” :
Type Price (Rs.)
TROUSER 1500
SHIRT 1200
For Material other than “COTTON” the above
mentioned Price
gets reduced by 25%.
43. (c) Define a class Clothing in C++ with the
following descriptions:
Outside Delhi 2008 4
Public Members:
A constructor to assign initial values of Code,
Type and Material with the word “NOT
ASSIGNED” and Size and Price with 0.
A function Enter( ) to input the values of the
data members Code, Type, Size
and Material and invoke the CalcPrice( )
function.
A function Show( ) which displays the content
of all the data members for a Clothing
50. (½ Mark for correct Enter() with proper
invocation of Calc_Price())
(½ Mark for displaying all data Members in
function Show())
51. (c) Define a class RESORT in C++ with
following description:
Delhi 2009 4
Private Members
Rno //Data member to store Room No
Name //Data member to store customer name
Charges //Data member to store per day
charges
Days //Data member to store number of days
of stay
COMPUTE( ) //A function to calculate’ and
return Amount as
52. (c) Define a class RESORT in C++ with
following description:
Delhi 2009 4
Days*Charges and if the value of
Days*Charges is more than 11000
then as 1.02*Days*Charges
Public Members
Getinfo ( ) //A function to enter the content
Rno, Name, Charges and Days
Dispinfo ( ) //A function to display Rno, Name,
Charges,Days and Amount (Amount to be
displayed by calling function COMPUTE ( ) )
53. Ans class RESORT
{
int Rno;
char Name [20];
float Charges;
int Days;
float COMPUTE();
public:
void Getinfo() ;
void Dispinfo();
};
55. float RESORT::COMPUTE()
{
float Amount = Charges*Days;
if (Amount>11000)
Amount = 1.02*Days*Charges;
return Amount;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of COMPUTE ( )) .
56. (1 Mark for correct definition of Dispinfo( ) with
proper invocation of COMPUTEO function)
(1 Mark for correct definition of Getinfo( ))
NOTE: Deduct ½ Mark if COMPUTE( ) is not
invoked properly inside Dispinfo( ) function
57. (c) Define a class HOTEL in C++ with the
following description:
Outside Delhi 2009 4
Private Members:
Rno //Data member to store Room No
Name //Data member to store customer name
Tariff //Data member to store per day charges
NOD //Data member to store number of days of
stay
CALC( ) //A function to calculate and return
Amount as NOD*Tariff and if the value of
NOD*Tariff is more than 10000 then as
1.05*NOD*Tariff
58. (c) Define a class HOTEL in C++ with the
following description:
Outside Delhi 2009 4
Public Members
Checkin ( ) / / A function to enter the content
Rno, Name, Tariff and NOD
Checkout( ) / / A function to display Rno,
Name, Tariff,NOD and Amount (Amount to be
displayed by calling function CALC( ))
59. Ans class HOTEL
{
int Rno;
char Name[20];
float Tariff;
int NOD;
float CALC() ;
public:
void Checkin() ;
void Checkout() ;
} ;
61. void HOTEL::Checkout()
{
cout<<Rno<<” “<<Name<<“ “<<Tariff<<”
“<<NOD<<
CALC ()<<endl;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of CALC( ))
(1 Mark for correct definition of Checkout( )
with proper invocation of CALC( ) function)
62. (1 Mark for correct definition of Checkin())
NOTE: Deduct ½ Mark if CALC() is not
invoked properly inside Checkout( )
function
63. (c) Define a class ITEM in C++ with following
description:
Delhi 2010 4
Private Members
Code of type integer (Item Code)
Iname of type string (Item Name)
Price of type float (Price of each item)
Qty of type integer (Quantity of item in stock)
Offer of type float (Offer percentage on the
item)
64. (c) Define a class ITEM in C++ with following
description:
Delhi 2010 4
A member function GetOffer() to calculate
Offer percentage as per the
following rule:
If Qty<=50 Offer is 0
If 50<Qty<=100 Offer is 5
If Qty>100 Offer is 10
65. (c) Define a class ITEM in C++ with following
description:
Delhi 2010 4
Public Members
A function GetStock() to allow user to enter
values for Code, Iname,
Price, Qty and call function GetOffer() to
calculate the offer
A function ShowItem() to allow user to view
the content of all the data
members
66. Ans. class ITEM
{
int Code;
char Iname [20] ;
float Price;
int Qty;
float Offer;
void GetOffer() ;
public:
void GetStock ()
{
cin>>Code;
68. void ITEM: : GetOffer ()
{
if (Qty<=50)
Offer = 0;
else if (Qty <=100)
Offer = 5; / /OR Offer = 0.05;
else
Offer = 10; / /OR Offer = 0.1;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
69. (1 Mark for correct definition of GetOffer())
(1 Mark for correct definition of GetStock () with
proper invocation of GetOffer()
function)
(1 Mark for correct definition of Showltem())
NOTE:
Deduct ½ Mark if GetOffer() is not invoked
properly inside GetStock()function
70. (c) Define a class STOCK in C++ with
following description:
OUTSIDE DELHI 2010 4
Private Members
ICode of type integer (Item Code)
Item of type string (Item Name)
Price of type float (Price of each item)
Qty of type integer (Quantity in stock)
Discount of type float (Discount percentage
on the item)
71. (c) Define a class STOCK in C++ with
following description:
OUTSIDE DELHI 2010 4
A member function FindDisc() to calculate
discount as per the following rule:
If Qty<=50 Discount is 0
If 50<Qty<=100 Discount is 5
If Qty>100 Discount is 10
72. (c) Define a class STOCK in C++ with
following description:
OUTSIDE DELHI 2010 4
Public Members
A function Buy() to allow user to enter values
for ICode, Item, Price,
Qty and call function FindDisc() to calculate
the Discount.
A function ShowAll( ) to allow user to view the
content of all the data
members.
73. Ans. class STOCK
{
int ICode,Qty;
char Item[20];
float Price,Discount;
void FindDisc();
public:
void Buy();
void ShowAll();
} ;
77. (1 Mark for correct definition of Buy() with
proper invocation of FindDisc() function)
(1 Mark for correct definition of ShowAll())
NOTE:
Deduct ½ Mark if FindDisc() is not invoked
properly inside Buy() function
78. (c) Define a class Candidate in C++ with
following description:
Delhi 2011 4
Private Members
A data member RNo (Registration Number) of
type long
A data member Name of type string
A data member Score of type float
A data member Remarks of type string
A member function AssignRem( ) to assign
Remarks as per the Score obtained by a
candidate. Score range and the respective
Remarks are shown as follows:
79. (c) Define a class Candidate in C++ with
following description:
Delhi 2011 4
Score Remarks
>=50 Selected
less than 50 Not selected
Public Members
A function ENTER ( ) to allow user to enter
values for RNo, Name, Score & call function
AssignRem( ) to assign the remarks.
A function DISPLAY ( ) to allow user to view
the content of all the data members.
80. Ans class Candidate
{
long RNo;
char Name[20];
float Score;
char Remarks[20];
void AssignRem( ) ;
public:
void Enter( );
void Display( );
} ;
82. void Candidate: :Display()
{
cout<<RNo<<Name<<Score<<Remarks<<endl;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of AssignRem())
(1 Mark for correct definition of Enter() with
proper invocation of AssignRem() function)
83. (1 Mark for correct definition of Display())
NOTE:
Deduct ½ Mark to be deducted if
Assignrem() is not invoked properly inside
Enter( ) function
No marks to be deducted if member function
definitions are writteninside the class
84. (c) Define a class Applicant in C++ with
following description:
OUTSIDE DELHI 2011 4
Private Members
A data member ANo (Admission Number) of
type long
A data member Name of type string
A data member Agg (Aggregate Marks) of type
float
A data member Grade of type char
A member function GradeMe() to find the
85. (c) Define a class Applicant in C++ with
following description:
OUTSIDE DELHI 2011 4
Grade as per the Aggregate Marks obtained by
a student. Equivalent Aggregate Marks range
and the respective Grades are shown as
follows:
Aggregate Marks Grade
>=80 A
less than 80 and >=65 B
less than 65 and >=50 C
less than 50 D
86. (c) Define a class Applicant in C++ with
following description:
OUTSIDE DELHI 2011 4
Public Members
A function ENTER() to allow user to enter
values for ANo, Name, Agg & call function
GradeMe() to find the Grade.
A function_RESULT( ) to allow user to view
the content of all the data members.
87. Ans class Applicant
{
long ANo;
char Name [20] ;
float Agg;
char Grade;
void Grademe ( ) ;
public:
void Enter ( ) ;
void Result ( ) ;
} ;
88. void Applicant: :GradeMe( )
{
if (Agg>=80)
Grade=' A' ;
else if(Agg>=65)
Grade=' B' ;
else if(Agg>=50)
Grade=' C' ;
else
Grade=' D' ;
}
90. (½ Mark for correct syntax for class header)
(½ Mark for correct declaration of data
members)
(1 Mark for correct definition of GradeMe( ))
(1 Mark for correct definition of Enter() with
proper invocation of GradeMe( ) function)
(1 Mark for correct definition of Result())
NOTE:
½ mark to be deducted if Grademe() is not
invoked within Enter()
No marks to be deducted if member function
definitions are inside the Class
91. (c) Define a class TEST in C++ with following
description:
SAMPLE PAPER 2010 SET I 4
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)
92. (c) Define a class TEST in C++ with following
description:
SAMPLE PAPER 2010 SET I 4
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
93. (c) class TEST
{
int TestCode;
char Description[20];
int NoCandidate,CenterReqd;
void CALCNTR();
public:
void SCHEDULE();
void DISPTEST();
};
95. void TEST::DISPTEST()
{
cout<<"Test Code :"<<TestCode<<endl;
cout<<"Description :"<<Description<<endl;
cout<<"Number :"<<NoCandidate<<endl;;
cout<<"Centres :"<<CenterReqd<<endl;;
}
(½ Mark for correct syntax for class header)
(½ Mark for correct declarations of data
members)
96. (1 Mark for appropriate definition of function
CALCNTR())
(1 Mark for appropriate definition of
SCHEDULE() with a call for CALCNTR())
(1 Mark for appropriate definition of
DISPTEST())
97. (c) Define a class FLIGHT in C++ with
following description:
SAMPLE PAPER 2010 SET II 4
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
98. 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
99. (c) class FLIGHT
{
int Fno;
char Destination[20];
float Distance, Fuel;
void CALFUEL();
public:
void FEEDINFO();
void SHOWINFO();
};
103. (½ Mark for correct syntax for class header)
(½ Mark for correct declarations of data
members)
(1 Mark for appropriate definition of function
CALFUEL())
(1 Mark for appropriate definition of
FEEDINFO() with a call for CALFUEL())
(1 Mark for appropriate definition of
SHOWINFO())