Java BankAccount program

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 10
Reputation: visual one is an unknown quantity at this point 
Solved Threads: 0
visual one visual one is offline Offline
Newbie Poster

Java BankAccount program

 
0
  #1
Aug 10th, 2005
hi I need a java program that will use parallel array to hold an account number, account holders name, withraw, deposit, intial balance, balance and overdraft fee. It must also print out the account number, account holders name and balance.


thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java BankAccount program

 
0
  #2
Aug 10th, 2005
hmm, is it the start of the new school year where you are?
Get a good book, there's at least one I know of that develops just that as one of its core example applications, good luck in finding it (will give you at least some work to do before you turn in the code verbatim as your own)
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 8
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Java BankAccount program

 
0
  #3
Aug 10th, 2005
Hi everyone,

I remember doing some simple banking programs thread some where else and here is the link

http://wizardsolutionsusa.com/progra...topic.php?t=59

I hope this has helped you

Thank You

Yours Sincerely

Richard West
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 10
Reputation: visual one is an unknown quantity at this point 
Solved Threads: 0
visual one visual one is offline Offline
Newbie Poster

Re: Java BankAccount program

 
0
  #4
Aug 10th, 2005
Here's the program that I wrote, but I'm having problems with my ending balance and overdraft fee. The overdraft fee is multiplied by whatever amount I enter: can some help; here's the program:

import java.io.*;
import java.lang.*;


public class BankAccount5
{
public static void main(String[]args)throws IOException
{
char [] newType = new char [20];
double [] newTransaction = new double [20];
double [] newBalance = new double [20];
int o = 0;
int s = 0;
int t = 0;

BufferedReader console = new BufferedReader (
new InputStreamReader(System.in));

System.out.println(" Enter Your Name");
String name = console.readLine();

System.out.println("Hello " + name);
System.out.println(name +" " + "enter your account number");
String account = console.readLine();

System.out.println(" enter your original balance");
String Bal = console.readLine();
double initialBalance = Double.parseDouble(Bal);
double balance = initialBalance;


System.out.println("Enter c for Check; d for Deposit; or p to Print Summary");
char continueAnswer = console.readLine().charAt(0);
boolean answer = true;
newType [o] = continueAnswer;

if (continueAnswer == 'p')answer = false;

double Fee;
double OverdraftTotal = 0;
double checks = 0;
double deposit = 0;
double TotalBalance = 0;

while (answer == true)
{
System.out.println("Enter amount");
String input = console.readLine();
double transaction = Double.parseDouble(input);
newTransaction [o] = transaction;


if (continueAnswer == 'c')
checks = checks + transaction;

{
checks = checks + 0;
if (transaction > balance)
{
if (transaction > 250)
Fee = transaction * .10;
else
Fee = 25.00;
balance = (balance + transaction) - Fee;
newBalance [t] = TotalBalance;
OverdraftTotal = OverdraftTotal + Fee;
o = o + 0;
t = t + 0;
newType [o] = 'f';
newTransaction [o] = Fee;


}
else
balance = balance - transaction;
newBalance [t] = balance;

}
if (continueAnswer == 'd')
deposit = deposit + transaction;
balance = deposit + transaction;
newBalance [t] = balance;
o = o + 0;
t = t + 1;

System.out.println("Enter c for Check; d for Deposit; or p to Print Summary");
continueAnswer = console.readLine().charAt(0);
newType [o] = continueAnswer;
if (continueAnswer == 'p')answer = false;

}
if (balance <= 0)
System.out.println("Your account insufficient, You should enter $" + balance + " to bring account current");


System.out.println("Name " + name + ", Account Number " + account);
System.out.println(" Account Statement");
System.out.println("Your balance " + balance);
System.out.println("Amount of checks: " + checks);
System.out.println("Overdraft total fees: $" + OverdraftTotal);
System.out.println("Total Checks: $" + checks);
System.out.println("Total Deposits: $" + deposit);
while (s < o)
{
System.out.println(newType[s] + " " + newTransaction [s] + " " + newBalance[s]);
s = s + 1;
System.out.println("");
}
}
}
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 55
Reputation: NPH is an unknown quantity at this point 
Solved Threads: 1
NPH NPH is offline Offline
Junior Poster in Training

Re: Java BankAccount program

 
0
  #5
Aug 11th, 2005
1. Shouldn't TotalBalance start off with the initial balance?
  1. double TotalBalance = initialBalance
  2. //not: double TotalBalance = 0

2. When there are insufficient funds for a check, shouldn't the original transaction be cancelled and only the overdraft charge applied?
  1. balance = (balance) - Fee;
  2. //not: balance = (balance + transaction) - Fee;

3. Near line 78, it appears that you are missing the { } for the if.
The third line below is always executing even during withdrawals.

  1. if (continueAnswer == 'd')
  2. deposit = deposit + transaction;
  3. balance = deposit + transaction;

4. Near line 82, Shouldn't o also be incremented as well? It is the transaction counter right?
  1. o = o + 0;
  2. t = t + 1;
For more help, www.NeedProgrammingHelp.com
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 1
Reputation: onkar is an unknown quantity at this point 
Solved Threads: 0
onkar onkar is offline Offline
Newbie Poster

Re: Java BankAccount program

 
0
  #6
Aug 18th, 2005
mmm..tough problem
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 28
Reputation: proghelper is an unknown quantity at this point 
Solved Threads: 0
proghelper proghelper is offline Offline
Light Poster

Re: Java BankAccount program

 
0
  #7
Aug 18th, 2005
You have written all the code in single program.
Why not break the logic for withraw, deposit, inquire balance, etc. operations into seperate methods.

-------------------------------

Programming (Assignment/Project) Help
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Java BankAccount program

 
0
  #8
Aug 18th, 2005
Where's the snychronization? Your balance can become negative if you don't sync it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 8998 | Replies: 7
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC