inheretance and ArrayList in java ..i want to know the mistake in my code
hello every body
i am tring to solve this problem ,but i think there is smth wrong cna any body help me Quote:
this is my code |
Really? I did not see the following in your requirements.
Code:
public class BranchBank extends BankAccount{ A BranchBank contains one or more BankAccounts... keyword being "contains". Quote:
|
Quote:
Quote:
|
I think you misunderstood.
Quote:
Code:
public class BranchBank |
Quote:
protected ArrayList<BankAccount> accounts; inside BranchBank without using inheretance |
now i will modify it .what about the rest of the code?
|
Quote:
If that's not what you meant then please clarify. |
thanx
|
Quote:
beause my solution to other tasks will be wrong if these codes are wrong. I were doing my best. |
You could start by wrapping your code in CODE tags rather than QUOTE tags, so that we can read it.
|
.....
|
Looks like you got it.
|
it is too long problem.I am waiting for you reply.thanks so much
|
Quote:
|
Uhm, yeah, it looks like you've completed the requirements that you posted.
|
1- Is it correct to write the header of each class like what i did?!
2 - I think my first code is correct.Is it correct?! 3- The second code .I think it is all correct except a small problem with return b...i try to add finaly bolck to solve the porblem .But it is also didn't work...How I can return the b which is in try bolck ? |
I am learning java from the zero in this semester only.
|
these are the files that I used to solve
Quote:
[/COLOR]I were check the other task [QUOTE] 5. (4pts) Operations a sub-class of the super class BankName which read from a operation file some operations on different account and perform the necessary operations debitAccount or withdrawAccount. 6. (2pts) The client class should create the BankName and prints all the accounts information in all the branches. 7. (4pts) The client class should perform the operations stored in the operation file (if possible otherwise an error message should be displayed) and then prints all the branches in the screen and also in a new outputbank file. You can add any method to this class if you see it necessary. |
From code you posted earlier, the following also seems incorrect:
Code:
public class BankName extends BranchBank Code:
public class BankName Code:
//read next string |
Quote:
comment about the first point it is not correct by logic to say that BankName extends BranchBank but i think i need to do that beacuse i can't say this statement if (a.accountName == accountName11 && a.IdBranch == IdBranch111)// found a match inside searchAccount method. |
Quote:
Code:
class BankAccount |
Quote:
we have to put each class in sapreate file. |
All times are GMT -5. The time now is 10:02 PM. |