/** * @author the Great Ke * */ public class Customer extends Person { /** * @param name * @param idCode * @param telephoneNum * @param address * @param bankCardId */ public Customer(String name, String idCode, String telephoneNum, String address, String bankCardId) { super(name, idCode, telephoneNum, address); this.bankCardId = bankCardId; } private String bankCardId; private ShopList shopList = new ShopList(); public boolean pay(int price) { return false; } public boolean addCommentToFood(String comment) { return false; } /** * @return the bankCardId */ public String getBankCardId() { return bankCardId; } /** * @return the shopList */ public ShopList getShopList() { return shopList; } /** * @param bankCardId the bankCardId to set */ public void setBankCardId(String bankCardId) { this.bankCardId = bankCardId; } /** * @param shopList the shopList to set */ public void setShopList(ShopList shopList) { this.shopList = shopList; } /* * (non-Javadoc) * * @see Person#toString() */ @Override public String toString() { // TODO Auto-generated method stub return super.toString() + "BankCardId: " + getBankCardId(); } }
时间: 2024-03-30 10:33:49 浏览: 48
捷行笔试.doc
这段代码是一个 Java 类的定义,名为 `Customer`,继承自 `Person` 类。该类有以下属性:
- `bankCardId`: String 类型,表示银行卡号;
- `shopList`: `ShopList` 类型,表示购物清单。
该类有以下方法:
- `Customer`: 构造方法,用于初始化该类的对象;
- `pay`: 用于支付,返回一个布尔值;
- `addCommentToFood`: 用于添加对食品的评论,返回一个布尔值;
- `getBankCardId`: 获取银行卡号;
- `getShopList`: 获取购物清单;
- `setBankCardId`: 设置银行卡号;
- `setShopList`: 设置购物清单;
- `toString`: 重写 `Person` 类中的 `toString` 方法,返回一个字符串。
该类的作用和实现细节无法完全解释,需要更多的上下文信息。
阅读全文