Lab Assignment
Lab Assignment
The list includes details such as author, title, price, publisher and stock
position. Whenever a customer wants a book, the sales person inputs the
title and author and the system searches the list and displays weather it
available or not. If it is not, an appropriate message is displayed. If it is,
then the system displays the book details and request for the number of
copies required. If the requested copies are available, the total cost of
requested copies is displayed; otherwise the message Required copies not in
the stock is displayed. Design a system using a class called books with suitable
member functions and constructors.
Provide these extra facilities in the program:
i.
The price of the books should be updated as and when required. Use a
private member function to implement this.
ii.
The stock value of each book should be automatically updated as
soon as a transaction is completed.
iii.
The number of successful and unsuccessful transactions should be
recorded for the purpose of statistical analysis. Use static data
members to keep count of transactions.
2. Define a class employee. Take name, designation, age, DoB, address and years
of experience as data members and getdata and showdata as methods. Now
enter the details of 10 employee using array of objects.
3. Assume that a bank maintains two kinds of accounts for customers, saving
and current.
The savings account provides compound interest and withdrawal facility.
The current account provides cheque book facility but no interest. Current
account holders should also maintain a minimum balance and if the
balance falls below this level, a service charge is imposed. Create a class
account that stores customer name, account number and type of
account. Inherit the account class into cur_acct and sav_acct. Include the
a. Accept deposit from a customer and update the
balance.
b. Display the balance
c. Compute and deposit interest
d. Permit withdrawal and update the balance
e. Check the minimum balance, impose penalty and update the balance
information of staff. Inherit this information in teacher and officer class not in
the typist class. Inherit teacher and oficer into education class.
5. Create a base class shape. Take two data members of double types to
compute the area of diferent shapes. Derive two classes triangle and
rectangle from the base shape. Include constructors in every class to
initialize the objects. Include one pure virtual function compute_area() to
compute area. Using these classes, write a c++ program to compute the
area of triangle and rectangle.