Page 38 - C++
P. 38
Instance attribute.
Class Attributes belong to the class itself. These attributes will be shared by all the
instances. Such attributes are defined in the class body part, usually at the top, for
legibility.
Attributes defined for each class instance are known as Instance Attributes. These are
called instance attributes and they belong to each instance/object of a class.
(1 mark for correct point of difference)
(ii) Fill in the blanks: 1
B= BOOK()
______________________________ #Write statement to invoke Function 2
______________________________ #Write statement to invoke Function 3
Ans
( ½ mark for each correct statement)
(c) Define a class COURSE in Python with the following description : 4
Instance Attributes:
REGNO Integer
CNAME String
Score Float
Fees Float
Methods:
A constructor to assign REGNO as 0, Score and Fees as 0.0
SetCourse() to assign Course and Fees on the basis of the Score input as
per the following criteria:
Score CNAME Fees
>=9.0 -<=10.0 Clinical Psychology 10000.0
>=8.0 - <9.0 Corporate Counselling 8000.0
>=5.0 - <8.0 Guidance and
Counselling 6000.0
less than 5.0 Not Eligible 0.0
GETDATA() to input REGNO and Score and invoke SetCourse()
DISPLAY() to display all the details.
Page No. 21