- 44
- 0
- 约1.96千字
- 约 25页
- 2021-03-26 发布于北京
- 举报
项目二客户信息管理软件;目 标;需求说明;需求说明;需求说明;需求说明;需求说明;需求说明;软件设计结构;;enterMainMenu()方法的活动图;键盘访问的实现;键盘访问的实现; Customer为实体类,用来封装客户信息
该类封装客户的以下信息:
String name :客户姓名
char gender :性别
int age :年龄
String phone:电话号码
String email :电子邮箱
提供各属性的get/set方法
提供所需的构造器(可自行确定)
;第1步 — 实现Customer类;CustomerList为Customer对象的管理模块,内部使用数组管理一组Customer对象
本类封??以下信息:
Customer[] customers:用来保存客户对象的数组
int total = 0 :记录已保存客户对象的数量
该类至少提供以下构造器和方法:
public CustomerList(int totalCustomer)
public boolean addCustomer(Customer customer)
public boolean replaceCustomer(int index, Customer cust)
public boolean deleteCustomer(int index)
public Customer[] getAllCustomers()
public Customer getCustomer(int index)
public int getTotal()
;public CustomerList(int totalCustomer)
用途:构造器,用来初始化customers数组
参数:totalCustomer:指定customers数组的最大空间
public boolean addCustomer(Customer customer)
用途:将参数customer添加到数组中最后一个客户对象记录之后
参数:customer指定要添加的客户对象
返回:添加成功返回true;false表示数组已满,无法添加
public boolean replaceCustomer(int index, Customer cust)
用途:用参数customer替换数组中由index指定的对象
参数:customer指定替换的新客户对象
index指定所替换对象在数组中的位置,从0开始
返回:替换成功返回true;false表示索引无效,无法替换
;public boolean deleteCustomer(int index)
用途:从数组中删除参数index指定索引位置的客户对象记录
参数: index指定所删除对象在数组中的索引位置,从0开始
返回:删除成功返回true;false表示索引无效,无法删除
public Customer[] getAllCustomers()
用途:返回数组中记录的所有客户对象
返回: Customer[] 数组中包含了当前所有客户对象,该数组长度与对象个数相同。
public Customer getCustomer(int index)
用途:返回参数index指定索引位置的客户对象记录
参数: index指定所要获取的客户在数组中的索引位置,从0开始
返回:封装了客户信息的Customer对象
;cust1;第2步 — 实现CustomerList类;第2步 — 实现CustomerList类;第3步 — CustomerView类的设计;public void enterMainMenu()
用途:显示主菜单,响应用户输入,根据用户操作分别调用其他相应的成员方法(如addNewCustomer),以完成客户信息处理。
private void addNewCustomer()
private void modifyCustomer()
private void deleteCustomer()
private void listAllCustomers()
用途:这四个方法分别完成“添加客户”、“修改客户”、“删除客户”和“客户列表”等各菜单功能。
这四个方法仅供enterMainMenu()方法调用。
public static void main(String[] args)
用途:创建CustomerView实例,并调用 enterMainMenu()方法以执行程序。;第3步 — 实现CustomerView类
原创力文档

文档评论(0)