You are on page 1of 1

Programming Questions based on classes

1) Assume that a bank maintains two kinds of accounts for its customers, one called
“savings account” and other “checking account”. The savings account provides
compound interest and withdrawal facilities. The checking account provides
cheque book facility, the customer should maintain a minimum balance of 500$.
If the balance for a customer falls below this amount, a service charge of 5$ is
imposed on that account.
The accounts contain following information:

Customer Account Number


Customer Name
Customer Type : C or S or both.

Constructor method for initializations.


Other methods depending on your choices.

2) Create a class “Computer” that stores information about different types of


computers available with a dealer. The information to be stored about a single
computer is,
a. Company Name.
b. RAM size.
c. Hard Disk Capacity.
d. Processor speed.
e. Price.
f. Quantity of computers.
The class contains the following methods,

- Constructor method that assigns user input values to above mentioned


variables.
- Main() method that creates an array of 4 objects of computer class and that
takes input for all the above details from the user and calls method to
check validity of Quantity and Price values. If all values are valid then
create the objects and display the details.
- Method that checks the validity of quantity and price. If the quantity is 0
or negative then method should throw user defined exception with
appropriate message and exit out of the program. Similarly if the price is 0
or negative then it should throw user defined exception with appropriate
message and exit the program.
- Method that displays all details about a single instance of computer.

You might also like