You are on page 1of 1

1.

To write a Java program which implements mul�ple classes related with


inheritance. The program should have a main class Product, subclasses Book and
CD. Also create a sub-class for Book called Scien�fic. All the Subclass should inherit
the proper�es of the main class and it can have its own proper�es also. Observe the
inheritance hierarchy output and display.

2. Develop a Java program to define a class called Account which contains two
private data elements, an integer account number and a floa�ng-point account
balance and three methods:

a. A constructor that allows the user to set ini�al values for account
number and account balance and a default constructor that prompts for
the input of the values for the above data members.
b. A method which reads a character value for transac�on type (D for
deposit and W for withdrawal), and a floa�ng-point value for transac�on
amount, and updates account balance.
c. A method, which prints on the screen the account number and
account balance.

*************************************************

You might also like