日期:2014-05-20  浏览次数:20551 次

新手遇到难题!大家帮忙!
我是JAVA新人,还没怎么入门,有个题目是 创建银行账户类。银行账户类包括账号、用户姓名、密码和余额属性,银行账户类的功能包括开户、查询余额、取款、存款。
  拜托大家教我写下。。。 感觉无从下手!

------解决方案--------------------
Java code

public class BankAccount {

    private String account;

    private String pwd;

    private double restNum;

    private String userName;

    public BankAccount(String account, String pwd, double restNum,
            String userName) {
        this.account = account;
        this.pwd = pwd;
        this.restNum = restNum;
        this.userName = userName;
    }

    //取
    public void getMondey(double num) {
        restNum -= num;

    }
    //存
    public void putMoney(double num) {
        restNum += num;
    }

    public double getRestNum() {
        return restNum;
    }

    public void setRestNum(double restNum) {
        this.restNum = restNum;
    }

}