Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners bank account gui

Have Programming Question? Ask it here!
 
 
 


kevin
bank account gui
2 Answer(s)      a year and 7 months ago
Posted in : Java Beginners


Add event handling to the AccountUI class which will allow you to:

1.Create new account, when the ‚??Create‚?? button is pressed

a) Make sure the user has entered an ID and the starting balance

b) Create an account using the Account class constructor

c) Update the ‚??Current Balance‚?? Text field in the Transaction report section

d) Update the ‚??Account Date Created‚?? Text Field

e) Hint: declare a global class variable of the type Account so it could be used in the AccountUI inner classes (ActionListener classes).

2.Execute a ‚??Deposit‚?? or ‚??Withdrawal‚?? when the ‚??Execute‚?? button is pressed

a) Use the Account correct method for the specific transaction

b) Make sure that an amount is entered and one of the Radio buttons is selected.

c) Update the ‚??Current Balance‚?? Text field in the Transaction report section d) Add the transaction to the list of transactions defined in the Account class

3.Show all transactions in the TextArea when the ‚??Report‚?? button is pressed

a) Get the list of transactions using the getTrasactions() method of the class Account.

b) For each transactions print: date of transaction, type of transaction, amount of transaction and balance after transaction execution.

c) All of the methods are provided by the interface Transaction.

4.Add the interface transaction to your project

5.Add the inner class ‚??TransactionObject‚?? in the Account class.

6.Add the object transactionList to the Account class as follow:

a) List<Transaction> transactionList = new ArrayList< Transaction>();

I already done with the GUI i just need the code to make the button acctually work


Advertisement
View Answers

December 4, 2012 at 10:55 AM


Here is an example of BankAccount using swing components which allow the user to withdraw and deposit amount and display the current balance.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Account extends Frame {
Label lab=new Label(" ");
Label lab1=new Label(" ");
TextField t[]=new TextField [4];
Label l[]=new Label [4];
Button but=new Button("Create Account");
Button but1=new Button("Test Account");
BankAccount b;
Account(){
addWindowListener(new NewWindowAdapter());
setLayout(new GridLayout(2,0));
Panel p=new Panel();
Panel p1=new Panel();
p.setLayout(new GridLayout(5,2));
p.setBackground(Color.pink);
p1.add(lab1);
p1.add(lab);
l[0]=new Label("Enter Your Account Number");
l[1]=new Label("Enter Your Initial Balance");
l[2]=new Label("Deposit Amount");
l[3]=new Label("Withdraw Amount");
for(int i=0;i<4;i++){
t[i]=new TextField(10);
p.add(l[i]);
p.add(t[i]);
}
p.add(but);
p.add(but1);
but1.setVisible(false);
l[2].setVisible(false);
l[3].setVisible(false);
t[2].setVisible(false);
t[3].setVisible(false);
add(p);
add(p1);
p1.setBackground(Color.pink);
but.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String des=JOptionPane.showInputDialog(null,"Deposit or Withdraw");
if(des.equals("Deposit")){
b=new BankAccount(Integer.parseInt(t[0].getText()),Integer.parseInt(t[1].getText()));
but1.setVisible(true);
l[2].setVisible(true);
l[3].setVisible(false);
t[2].setVisible(true);
t[3].setVisible(false);
but.setVisible(false);
l[0].setVisible(false);
l[1].setVisible(false);
t[0].setVisible(false);
t[1].setVisible(false);
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
but1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
lab.setText(testAccount1(Integer.parseInt(t[2].getText())));
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
}
});
}
else if(des.equals("Withdraw")){
b=new BankAccount(Integer.parseInt(t[0].getText()),Integer.parseInt(t[1].getText()));
but1.setVisible(true);
l[2].setVisible(false);
l[3].setVisible(true);
t[2].setVisible(false);
t[3].setVisible(true);
but.setVisible(false);
l[0].setVisible(false);
l[1].setVisible(false);
t[0].setVisible(false);
t[1].setVisible(false);
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
but1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
lab.setText(testAccount2(Integer.parseInt(t[3].getText())));
lab1.setText("Account : "+b.accnum+", Current Balance : "+b.amount);
}
});
}
}
});
}
String testAccount1(int d_amt){
String msg;
b.deposit(d_amt);
msg="Transaction Succesful";
return msg;
}
String testAccount2(int w_amt){
String msg;
msg="Transaction Succesful";
try{
b.withdraw(w_amt);
}catch(FundsInsufficientException fe){
fe=new FundsInsufficientException(b.amount,w_amt);
msg=String.valueOf(fe);
}
return msg;
}
public static void main(String arg[]){
Account at=new Account ();
at.setTitle("Bank Account System");
at.setSize(500,300);
at.setVisible(true);
}
}
class NewWindowAdapter extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}


December 4, 2012 at 11:00 AM


continue..

class BankAccount{
int accnum;
int amount;
BankAccount(int num,int amt){
accnum=num;
amount=amt;
}
public void deposit(int amt){
amount=amount+amt;
}
public void withdraw(int amt) throws FundsInsufficientException{
if(amt>amount)
throw new FundsInsufficientException(amount,amt);
else
amount=amount-amt;
}
}
class FundsInsufficientException extends Exception{
int balance;
int withdraw_amount;
FundsInsufficientException(int bal,int w_amt){
balance=bal;
withdraw_amount=w_amt;
}
public String toString(){
return "Your withdraw amount ("+withdraw_amount+") is more than the balance ("+balance+"). No withdrawal was recorded.";
}
}

For more information, visit the following link:

http://www.roseindia.net/tutorial/java/core/bankAccountApplication.html



Related Tutorials/Questions & Answers:
bank account gui
bank account gui  Add event handling to the AccountUI class which will allow you to: 1.Create new account, when the ‚??Create‚?? button is pressed...[]){ Account at=new Account (); at.setTitle("Bank Account System"); at.setSize(500,300
Bank account gui
Bank account gui  Add event handling to the AccountUI class which will allow you to: 1. Create new account, when the √Ę‚?¨ň?Create√Ę‚?¨‚?Ę button... static void main(String arg[]){ Account at=new Account (); at.setTitle("Bank Account
Advertisements
validate bank account number
validate bank account number  how to validate bank account number in jsp
validate bank account number
validate bank account number  how to validate bank account number in jsp
how to generate bank account number?
how to generate bank account number?  how to generate account number?or format or rules for bank account number
Bank account manangement - Java Beginners
Bank account manangement  Assume that the bank maintains two kinds of accounts for its customers, one called savings account and the other current account. The savings account provides compound interest and withdrawal facilities
Java Bank Account Application
Java Bank Account Application Here we have created a Bank Account Application... to enter all the required information like, name, account number, account type...); System.out.println("Account No:" + accNo); System.out.println("Balance:" + bal
Design a class named BankAccount to hold datas for a bank account in Java using Bluej Software - Java Interview Questions
Design a class named BankAccount to hold datas for a bank account in Java... the following data for a bank account: - Balance - Number of deposits... of the deposit.The method should add the argument to the account balanc
security mangement for bank's IT infrastructure
security mangement for bank's IT infrastructure  how i can give account number to a customer in our bank database??? plz help me out
Bank project
Bank project   Create a class Customer a. Having Instance variables.... Method which displays the Customer details Create a Class Account a. Having Instance variables for Account Number(int), Account opening date(String), Account Type
Delete Account
Delete Account  How to delete account
bank application
bank application  hello sir I got the simple bank application project which is very useful but I want the database for this project kindly send me database for this simple online bank application
Account Java Question
Account Java Question  Create a new class called Bank and in the main method use class Account (lab 4) to create an array of 10 accounts. ‚?Ę Enter data for all accounts (account number,name, balance). ‚?Ę Add method getTotal
GUI
GUI  How to GUI in Net-beans ... ??   Please visit the following link: http://www.roseindia.net/java/java-tips/background/30java_tools/netbeans.shtml
bank management - Java Beginners
bank management  Assume that the bank maintains two kinds of accounts for its customers, one called savings account and the other current account. The savings account provides compound interest and withdrawal facilities
bank details - JSP-Servlet
bank details  hi i just need a coding for bank details... since iam... is first to set the user account details in database, and the to create a login... of the users account details.but the user can only withdraw or deposit the amount
Bank Management System
Bank Management System  I need a Bank Management System Project in Java Swing
abt the bank application
abt the bank application  pls can u send to me the user table and transaction table sql statement with their datatype used in this bank application to my email
Design a class named account
field named id for the account (default 0). § A double data field named balance for the account (default 0.0) § A double data field named annualInterestRate... dateCreated that stores the date when the account was created. § A no-arg
Account openning System - JSP-Servlet
Account openning System  hi i am a student &i wana to make a project thats related to Account openning System and House Financing System for a bank.plz tell me how many business processes included in it (both System
simple bank application - JSP-Servlet
simple bank application  hi i got ur codings...But if we register a new user it is not updating in the database...so plz snd me the database also.... Thank you
GUI framework
GUI framework  what do u mean by GUI framework
Simple Bank Application in JSP
Simple Bank Application in JSP       In this section, we have developed a simple bank... Transaction, check the account Deposit/Withdraw Cash details and display
GUI component
GUI component  How can a GUI component handle its own events
How can i modify my account in roseindia
How can i modify my account in roseindia  Presently am not using my gmail id. I have to modify my roseindia account. Please send the answer to following mail id
GUI problem
GUI problem  Create a class called CDProgram and write a GUI program to compute the amount of a certificate of deposit on maturity. The sample data follows: Amount deposited: 80000.00 Years: 15 Interest Rate: 7.75 Hint
gui question
gui question  design a gui application for me and write its code in which the user enters a no. in a textfield and onn clicking the button the sum of the digits of the no. should be displayed. hint: suppose the user enters 12
java gui
java gui   friends... good day.. i have doubt in java gui. ? i created 1 java gui application. That has two text fields jtext1,jtext2. case: user entered value in first textfield(jtext1) and pressed the enter key . the cursor
Convert the code to GUI
GUI code  GUI code
Java GUI
Java GUI  1) Using Java GUI, create a rectangular box that changes color each time a user click a change color button. 2) Modify Question 1 to include a new button named insert image, that allow user to insert a bitmap image
active ur account through mail - Java Beginners
activation account through email  Hi, good morning i am suresh i want some help from u my question is how to create a activation account through email and access the login permission? plz send the code this mail id  Hi
gui question
gui question  design a gui application and write code to accept a string from the user in a textfeild and print using option pane whether it is a palindrome or not. hint: abba is a palindrome   import java.awt.*; import
Convert the code to GUI
GUI Application example  GUI Application example
Convert the code to GUI
GUI Example  GUI Example code to learn
GUI problem
GUI problem  How do I make a Jbutton which is shaped like a circle. This button needs to be clicked in order to change color.   import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class
Rationale for GUI tutorial decisions
these into code. The standard bank account or employee examples are OK, but suffer... Table of Contents Rationale for GUI tutorial decisions Java offers many... learn GUI programming? All "normal" programs are GUI based, so this question
Convert the code to GUI
Java and GUI application Example  Java and GUI application Example
Convert the code to GUI
How to Convert the code to GUI   How to convert a code into GUI
Convert the code to GUI
Java GUI Class Example  Java GUI Class Example
Convert the code to GUI
GUI Java JSP application  GUI Java JSP application
Convert the code to GUI
GUI Application Development   GUI Application Development
Convert the code to GUI
Write a GUI Application  best way to write a GUI based application
project on bank management system - Swing AWT
project on bank management system  plz give me code to move from by clicking a button on one panel to other panel and the add textfield and label such as name , address etc to second panel and textfield are one below to other
 

 

 

DMCA.com