mike hew

Greenhorn
+ Follow
since Oct 26, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mike hew

As you can see, Circle DOESNOT extend to shape, and isnot suppose too!









14 years ago
no, circle extends twodimensionshape, which extends to shape under the program
14 years ago
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,

Thank you in advance.


14 years ago
CREATE the instance variable shapes, an array of Shape objects, with myFile.getCountOfRecords() elements

which I try'd: Shape[] shape = shapes;
but I get the error:


Exception in thread "main" java.lang.ClassCastException: Circle
at ShapeTest.loadShapesArray(ShapeTest.java:121)
at ShapeTest.main(ShapeTest.java:24)

14 years ago
so, probally this is the cause then?

//CREATE the instance variable shapes, an array of Shape objects,
//with myFile.getCountOfRecords() elements

Shape[] shape = shapes;
14 years ago
This is what I'm getting and don't understand why.

Can anyone explain why I would? Thank you in advance.

Exception in thread "main" java.lang.NullPointerException
at ShapeTest.loadShapesArray(ShapeTest.java:115)
at ShapeTest.main(ShapeTest.java:20)

line 20 and 115 are in the bold

14 years ago
The stuff in bold within the code is my area of question.
I try'd the following below the code, but that isn't it, where Am I going a stray?




Attempted code
14 years ago
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)

G:\COMPLE~1>

14 years ago
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
14 years ago
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


14 years ago
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 ]
14 years ago
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.

Now I go and get re-educated in spelling lol.
14 years ago
I've try this several different ways, but seems if I change it 1 way it get more errors or change it another way.

But still can't figure out how to change the errors?

-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:96: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
currentAcccount.getBalance() += sumOfBeginningBalances;
^
G:\NEW9~1\CheckingAccountsTest.java:109: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
handleWithdrawal(currentAcccount,Double.parseDouble(myFields[indexForWithdrawalAmount]));
^
G:\NEW9~1\CheckingAccountsTest.java:118: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
currentAcccount.getBalance() += sumOfEndingBalances;
^
G:\NEW9~1\CheckingAccountsTest.java:127: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
currentAcccount.getBalance() += sumOfBeginningBalances;
^
G:\NEW9~1\CheckingAccountsTest.java:140: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
handleWithdrawal(currentAcccount,Double.parseDouble(myFields[indexForWithdrawalAmount]));
^
G:\NEW9~1\CheckingAccountsTest.java:149: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountsTest
currentAcccount.getBalance() += sumOfEndingBalances;
^
6 errors

-Finished-


14 years ago
So our you saying something like this,

CheckingAccount currentAcccount = new CheckingAccount(arguments); ?
14 years ago
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

-Finished-


14 years ago