You are on page 1of 1

Concept - JDBC Difficulty Level 1

Create a table tbl_Account_<your employee id> with columns


number,acType,balance,noOfAccountHolders with appropriate data types. number is the
primary key and add unique constraint on number

Create a class Account with below attributes:

number - int

acType - String

balance - double

noOfAccountHolders - int

Create a default constructor which sets the default value as the value of the
attributes.

Create a class AccountDAO.

Create a method insertAccount in the DAO class which will take Account object as
the input parameter and inserts the record into tbl_Account_<your employee id>.

Use Prepared Statement for insertion.

Create a method selectAvgBalance with no parameters in the AccountDAO class which


will return average of balance for all the records present.

Create AccountDemo with main method and test the above methods.

You might also like