I found I think my problem but not sure how to fix it, I was naming as shapes and not what was asked in the bold, could someone give me an example or where to go and look, the book I have is not a good teacher,
Still trying to figure out line 55 and 104, but the other 2 have me just as lost, or are these reference of those 2 lines?
Big Bank: Monthly Checking Account Activity
----------- Account ----------- Beginning With- Ending Over- Credit Cd Name Id Type Balance + Deposit - drawal - Fee = Balance draft Advance 100.0 500.0 651.0Exception in thread "main" java.lang.NumberFormatException: For input string: "Regular" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224) at java.lang.Double.parseDouble(Double.java:482) at CheckingAccountsTest.handleAccount(CheckingAccountsTest.java:104) at CheckingAccountsTest.main(CheckingAccountsTest.java:55)
Ok the help with Brunborg, I was able to get this far. But I can't seem to figure out how to resolve it? at the bottom is the Psuedo code for these 2 parts.
Big Bank: Monthly Checking Account Activity
currentAccount = null, null currentAccount.getAccountId() = null myFields = [Ljava.lang.String;@1e0be38 myFields[indexForAccountId] = 0100C Exception in thread "main" java lang Null Pointer Exception at CheckingAccountsTest.handleAccount(CheckingAccountsTest.java:107) at CheckingAccountsTest.main(CheckingAccountsTest.java:56)
G:\NEW9~1>
A-1-2-07)Get 1st record from CSV file using method readARecord: MyCsvFile class: myFile.readARecord() A-1-2-08)WHILE (myFile.getEofFound() IS FALSE) A-1-2-09)DEFINE a String Array named myFields, and ASSIGN it the value myFile.getCsvRecordFieldArray() A-1-2-10)IF (myFields[indexForAccountType].equals(CheckingAccount.getAccountType())) A-1-2-11)INSTANTIATE a local variable named currentAccount of class CheckingAccount, passing the following arguments: A-1-2-12)myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-13)Double.parseDouble(myFields[indexForBalance]) A-1-2-14)line 56CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-15)ASSIGN null TO currentAccount A-1-2-16)ELSE A-1-2-17)INSTANTIATE a local variable named currentAccount of class CheckingAccountPlus, passing the following arguments: A-1-2-18)myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-19)Double.parseDouble(myFields[indexForBalance]) A-1-2-20)CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-21)ASSIGN null TO currentAccount A-1-2-22)END IF A-1-2-23)END WHILE This private static method has no return value, and has three parameters: currentAccount of type CheckingAccount, myFile of type MyCsvFile and myFields of type String array. A-1-3-01)CALL method currentAcccount.getBalance and ADD its return value to sumOfBeginningBalances A-1-3-02)CALL method printBeginningBalance with the following argument list: currentAccount A-1-3-03)CALL method myFile.readARecord, which reads the 1st record after the Balance record (a deposit or withdrawal) for the current customer A-1-3-04)CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the values from the A-1-3-05)fields in the record just read available for access as elements in the myFields string array A-1-3-06)WHILE (myFile.getEofFound()IS FALSE AND line 107currentAccount.getAccountId().equals(myFields[indexForAccountId])) A-1-3-07)IF (myFields[indexForRecordType].equals(recordTypeForDeposit)) A-1-3-08)CALL method handleDeposit with the following argument list: currentAccount, A-1-3-09)Double.parseDouble(myFields[indexForDepositAmount] A-1-3-10)ELSE A-1-3-11)CALL method handleWithdrawal with the following argument list: currentAccount, A-1-3-12)Double.parseDouble(myFields[indexForWithdrawalAmount] A-1-3-13)END IF A-1-3-14)CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer A-1-3-15)CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the A-1-3-16)fields in the record just read available for access as elements in the myFields string array A-1-3-17)END WHILE
OK, I fix the three C's problem, ok I can't spell, lol.
Now I have no error's but when I excute the program I get this:
Big Bank: Monthly Checking Account Activity
----------- Account ----------- Beginning With- Ending Over- Credit Cd
Name Id Type Balance + Deposit - drawal - Fee = Balance draft Advance
Exception in thread "main" java.lang.NullPointerException
at CheckingAccountsTest.handleAccount(CheckingAccountsTest.java :103)
at CheckingAccountsTest.main(CheckingAccountsTest.java:56)
G:\ ~1>
The Pseudo code state's this WHILE (myFile.getEofFound() IS FALSE) A-1-2-09) DEFINE a String Array named myFields, and ASSIGN it the value myFile.getCsvRecordFieldArray() A-1-2-10) IF (myFields[indexForAccountType].equals(CheckingAccount.getAccountType())) A-1-2-11) INSTANTIATE a local variable named currentAccount of class CheckingAccount, passing the following arguments: A-1-2-12) myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-13) Double.parseDouble(myFields[indexForBalance]) A-1-2-14) CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-15) ASSIGN null TO currentAccount A-1-2-16) ELSE A-1-2-17) INSTANTIATE a local variable named currentAccount of class CheckingAccountPlus, passing the following arguments: A-1-2-18) myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-19) Double.parseDouble(myFields[indexForBalance]) A-1-2-20) CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-21) ASSIGN null TO currentAccount A-1-2-22) END IF A-1-2-23) END WHILE
WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId])) A-1-3-07) IF (myFields[indexForRecordType].equals(recordTypeForDeposit)) A-1-3-08) CALL method handleDeposit with the following argument list: currentAccount, A-1-3-09) Double.parseDouble(myFields[indexForDepositAmount] A-1-3-10) ELSE A-1-3-11) CALL method handleWithdrawal with the following argument list: currentAccount, A-1-3-12) Double.parseDouble(myFields[indexForWithdrawalAmount] A-1-3-13) END IF A-1-3-14) CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer A-1-3-15) CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the A-1-3-16) fields in the record just read available for access as elements in the myFields string array A-1-3-17) END WHILE WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId])) A-1-4-07) IF (myFields[indexForRecordType].equals(recordTypeForDeposit)) A-1-4-08) CALL method handleDeposit with the following argument list: currentAccount, A-1-4-09) Double.parseDouble(myFields[indexForDeposit] A-1-4-10) ELSE A-1-4-11) CALL method handleWithdrawal with the following argument list: currentAccount, A-1-4-12) Double.parseDouble(myFields[indexForWithdrawal] A-1-4-13) END IF A-1-4-14) CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer A-1-4-15) CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the A-1-4-16) fields in the record just read available for access as elements in the myFields string array A-1-4-17) END WHILE
OK, I fix the three C's problem, ok I can't spell, lol.
Now I have no error's but when I excute the program I get this:
The Pseudo code state's this WHILE (myFile.getEofFound() IS FALSE) A-1-2-09)DEFINE a String Array named myFields, and ASSIGN it the value myFile.getCsvRecordFieldArray() A-1-2-10)IF (myFields[indexForAccountType].equals(CheckingAccount.getAccountType())) A-1-2-11)INSTANTIATE a local variable named currentAccount of class CheckingAccount, passing the following arguments: A-1-2-12)myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-13)Double.parseDouble(myFields[indexForBalance]) A-1-2-14)CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-15)ASSIGN null TO currentAccount A-1-2-16)ELSE A-1-2-17)INSTANTIATE a local variable named currentAccount of class CheckingAccountPlus, passing the following arguments: A-1-2-18)myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], A-1-2-19)Double.parseDouble(myFields[indexForBalance]) A-1-2-20)CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields A-1-2-21)ASSIGN null TO currentAccount A-1-2-22)END IF A-1-2-23)END WHILE
WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId])) A-1-3-07)IF (myFields[indexForRecordType].equals(recordTypeForDeposit)) A-1-3-08)CALL method handleDeposit with the following argument list: currentAccount, A-1-3-09)Double.parseDouble(myFields[indexForDepositAmount] A-1-3-10)ELSE A-1-3-11)CALL method handleWithdrawal with the following argument list: currentAccount, A-1-3-12)Double.parseDouble(myFields[indexForWithdrawalAmount] A-1-3-13)END IF A-1-3-14)CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer A-1-3-15)CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the A-1-3-16)fields in the record just read available for access as elements in the myFields string array A-1-3-17)END WHILE WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId])) A-1-4-07)IF (myFields[indexForRecordType].equals(recordTypeForDeposit)) A-1-4-08)CALL method handleDeposit with the following argument list: currentAccount, A-1-4-09)Double.parseDouble(myFields[indexForDeposit] A-1-4-10)ELSE A-1-4-11)CALL method handleWithdrawal with the following argument list: currentAccount, A-1-4-12)Double.parseDouble(myFields[indexForWithdrawal] A-1-4-13)END IF A-1-4-14)CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer A-1-4-15)CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the A-1-4-16)fields in the record just read available for access as elements in the myFields string array A-1-4-17)END WHILE
Big Bank: Monthly Checking Account Activity
----------- Account ----------- Beginning With- Ending Over- Credit Cd
Name Id Type Balance + Deposit - drawal - Fee = Balance draft Advance
Exception in thread "main" java.lang.NullPointerException
at CheckingAccountsTest.handleAccount(CheckingAccountsTest.java :103)
at CheckingAccountsTest.main(CheckingAccountsTest.java:56)
G:\ ~1>
[ November 16, 2006: Message edited by: mike hew ] [ November 16, 2006: Message edited by: mike hew ]
Thank you both, I see what happens when you right a porgram or should I say 3 programs in 1 with over 40,000 bytes, about to make big mistakes, again thank you you so much.
Well I'm back, lol. Thank you all for the great advise, has help alot.
Have all 3 programs written with only 2 Errors.
Can someone help explain the following to me? -Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe- -Target File: G:\NEW9~1\CheckingAccountsTest.java- G:\NEW9~1\CheckingAccountsTest.java:98: variable currentAcccount might not have been initialized sumOfBeginningBalances += currentAcccount.getBalance(); ^ G:\NEW9~1\CheckingAccountsTest.java:130: variable currentAcccount might not have been initialized sumOfBeginningBalances += currentAcccount.getBalance(); ^ 2 errors