|
-
March 15th, 2010, 09:14 AM
#1
Create a java small class for a bank account!!?
I need to create a bank account class which consists of deposit and withdraw methods. I need to have a current account and savings account?
I also need help on how to extend it so I can ask the user to inpt their withdrawal amount and deposit and it gives out the balance using scanner funtion?
So far i have something like this, isit right?..
public abstract class BankAccount {
private double balance;
public BankAccount() {
balance = 0.;
}
public void deposit(double amount) {
balance += amount;
}
public withdraw(double amount) {
// check...
balance -= amount;
}
}
public class CurrentAccount extends BankAccount {
// additional stuff
}
public class SavingsAccount extends BankAccount {
// aditional stuff
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|