根据类的设计图编写类的框架代码

img

img

如有帮助,请采纳。点击我回答右上角【采纳】按钮。

public class CreditCard {
    private double limit;
    private String name;
    public int pay(double amount){
        return 1;
    }
    public boolean preAuth(double amount){
        return true;
    }
    public boolean check(String name){
        return true;
    }
}

public class CardHolder {
     private String name;
    private CreditCard card;
    public void display(String greetings){
        System.out.println(greetings);
    }
}

+是公有的public,-是私有的private 有()是方法,没有()是变量 :后面是返回类型 说的不全,可以参考参考