Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
33 views

Code 1

The bank manager asks the developer to create a basic banking application that allows a user to enter an account number, name, type, and balance. The application then displays a menu to credit, debit, or display the account details. It uses two classes - Main and Account, with the Main class getting user input and calling methods in the Account class to perform the transactions. The Account class constructor takes the account parameters and the class contains methods to credit, debit, and display the account details, showing insufficient funds for a debit over the balance.

Uploaded by

Joel Dsouza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Code 1

The bank manager asks the developer to create a basic banking application that allows a user to enter an account number, name, type, and balance. The application then displays a menu to credit, debit, or display the account details. It uses two classes - Main and Account, with the Main class getting user input and calling methods in the Account class to perform the transactions. The Account class constructor takes the account parameters and the class contains methods to credit, debit, and display the account details, showing insufficient funds for a debit over the balance.

Uploaded by

Joel Dsouza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

  Banking Application
There is bank near your home. The bank manager knows that you are very good in Java programming.
He approaches you to create an application for his bank. During your first demo you have to create a
simple scenario that gets the account number, account holder name and current balance of that
account. You should ask whether the user wants to deposit money or to withdraw money or to
display the account details.
The program should have two classes- Main.java and Account.java.
i.                    Create a class called Main. Declare four variables. accNum of type int,
holderName of String, type of String and bal of int.
accNum – Account Number
holderName – Account holder name
type – Account type ( Savings or Current)
ii.                  Pass these variables as parameters to the constructor in Account class.
bal – Current balance in account
iii.                Create a class called Account
iv.                 Create a constructor in Account that accepts four variables as arguments.
v.                   Create a method called credit() of void type which accepts the amount to be
credited from account as integer.
vi.                 Create a method called debit() of void type which accepts the amount to be
debited from account as integer. If the balance is less than the amount to be debited it
should display “Insufficient balance”.
vii.               Create a method called display() of void type which has no arguments and it
should display the account details.
viii.             In Main class using switch case call these methods.
1. Credit Account
2. Debit Account
3. Display Account Details
ix.                 If you want to credit or debit the amount get the amount from user in switch
case.
Sample Input and Output 1:
Enter the account number
23657
Enter the account holder name
Divs
Enter the type of account
Savings
Enter the balance
5600
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
1
Enter the amount to be credited
6000
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
3
Account Details
Accont Number : 23657
Accont Name : Divs
Accout type :Savings
Accout Balance :11600
 
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
2
Enter the amount to be debited
8000
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
3
Account Details
Accont Number : 23657
Accont Name : Divs
Accout type :Savings
Accout Balance :3600
 
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
2
Enter the amount to be debited
4000
Insufficient Balance
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
4

Sample Input and Output 2:


Enter the account number
53965
Enter the account holder name
Divya
Enter the type of account
Current
Enter the balance
5865
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
2
Enter the amount to be debited
3456
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
3
Account Details
Accont Number : 53965
Accont Name : Divya
Accout type :Current
Accout Balance :2409
 
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
4
 
Sample Input and Output 3:
Enter the account number
23578
Enter the account holder name
Venkat
Enter the type of account
Current
Enter the balance
4500
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
2
Enter the amount to be debited
5000
Insufficient Balance
1. Credit Account
2. Debit Account
3. Display Account Details
Enter your choice
4

You might also like