I am working on an assignement for class that is to create a program that manages bank accounts with acct number, customer name and balance. Need to use Random Access File, accessing records by index and not directly by account number.
What I am trying to do is to get the basic programs to work before I add the file access and hashtable portion. Found some sample code for Account and AccountTest but the Account Test does not compile. Code is below......
import java.util.Scanner;
public class TestAccount
{
public static void main(String[] args)
{
String name;
double balance;
long acctNum;
Account acct;
Scanner scan = new Scanner(System.in);
System.out.println("Enter account holder's first name");
name = scan.next();
acct = new Account(name);
System.out.println("Account for " + name + ":");
System.out.println(acct);
System.out.println("\nEnter initial balance");
balance = scan.nextDouble();
acct = new Account(balance,name);
System.out.println("Account for " + name + ":");
System.out.println(acct);
System.out.println("\nEnter account number");
acctNum = scan.nextLong();
acct = new Account(balance,name,acctNum);
System.out.println("Account for " + name + ":");
System.out.println(acct);
System.out.print("\nDepositing 100 into account, balance is now ");
acct.deposit(100);
System.out.println(acct.getBalance());
System.out.print("\nWithdrawing $25, balance is now ");
acct.withdraw(25);
System.out.println(acct.getBalance());
System.out.print("\nWithdrawing $25 with $2 fee, balance is now ");
acct.withdraw(25,2);
System.out.println(acct.getBalance());
System.out.println("\nBye!");
}
}
Error code:
cannot find symbol : constructor Account(java.lang.String) location: class Account acct = new Account(name); ^ TestAccount.java:29: cannot find symbol
Although this is not the final version of the AccountTest program I just wanted to get a 'start'.
Any ideas? Project is due tomorrow night at midnight..........
Thanks!!!!!!!!
Edited by Locke. In the future, please
This post has been edited by Locke: 24 October 2009 - 08:51 AM

New Topic/Question
Reply




MultiQuote










|