package com.lovecoding.day09.ex1;

public class CreditCard {
    private int account;
    private int money;

    /**
     * withdraw 取款
     * @param money
     */
    public void withdraw(int money){
        if (money <0 ){
            System.out.println("取款金额不能为负数");
        }
        if (money < this.money){
            this.money = (this.money - money);
        }
    }
    /**
     * withdraw 存款
     * @param money
     */
    public void save(int money){
        if (money <0 ){
            System.out.println("存款金额不能为负数");
        }else{
            this.money += money;
        }
    }

    public String getInfo(){
        return "账户:"+account+",余额:"+money;
    }

    public int getAccount() {
        return account;
    }

    public void setAccount(int account) {
        this.account = account;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }
}
