0% found this document useful (0 votes)
220 views

Lab Assignment

A bookshop maintains an inventory of books including details like author, title, price, publisher, and stock. A system allows customers to search for books by title and author and see if it is available. If so, it displays details and requests the number of copies. If the requested copies are available, it displays the total cost; otherwise it says copies are not in stock. The system was designed with a Books class containing member functions to implement this. It was enhanced with private member functions to update prices and stock automatically after transactions, and static data members to count successful and unsuccessful transactions.

Uploaded by

utkarsh
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
220 views

Lab Assignment

A bookshop maintains an inventory of books including details like author, title, price, publisher, and stock. A system allows customers to search for books by title and author and see if it is available. If so, it displays details and requests the number of copies. If the requested copies are available, it displays the total cost; otherwise it says copies are not in stock. The system was designed with a Books class containing member functions to implement this. It was enhanced with private member functions to update prices and stock automatically after transactions, and static data members to count successful and unsuccessful transactions.

Uploaded by

utkarsh
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. A book shop maintains the inventory of books that are being sold at the shop.

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

4. An educational institution wishes to maintain a database of its employees.


The database is divided into a number of classes as shown in the figure.
Specify all the classes and define functions to create the database and
retrieve individual information as and when needed. Include educational

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.

6. Implement generic sort using generic functions.

You might also like