Holiday Assignment Xii
Holiday Assignment Xii
7.
8.
How are lists different from strings when both are sequences?
9.
How are tuples different from lists when both are sequences?
3.
4.
5.
6.
members:
Data Members:
Number of people visited
Total amount of money collected
Members Functions:
To assign initial values (assign 0 to both data members)
To increment only people total in case ticket is not sold out
To increment people total as well as amount total if a ticket is sold out
To display the two totals
To display the number of tickets sold out (a tricky one)
Include a program to test this class.
46. Define a class represent a book in a library. Include the following members:
Data Members:
Book Number
Book Name
Author
Publisher
Price
No. of copies
No. of copies issued
Members Functions:
To assign initial values
To issue a book after checking for its availability (Increment No. of
copies)
To return a book (Decrement No. of copies)
To display book information
47. Define a class ITEMINFO in Python with the following description:
Data Members:
ICode (Item Code)
Item (Item Name)
Price (Price of each item)
Qty (quantity in stock)
Discount (Discount percentage on the item)
Netprice (Final Price)
Members Functions:
A member function FindDisc( ) to calculate discount as per the
following rule:
If Qty<=10 Discount is 0
If Qty (11 to 20) Discount is 15
If Qty>=20 Discount is 20
A constructor( __init__ method) to assign the value with 0 for ICode,
Price, Qty, Netprice and Discount and null for Item respectively.
Page 4 of 5
A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty
Page 5 of 5