Create a java small class for a bank account!!?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Create a java small class for a bank account!!?

  1. #1
    Join Date
    Mar 2010

    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

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999

    Re: Create a java small class for a bank account!!?

    It's a start. I suggest you work out on paper exactly how the bank accounts need to work before trying to write any Java code.

    If I had eight hours to chop down a tree, I would spend 6 hours sharpening an axe...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Azure Activities Information Page

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


HTML5 Development Center