CustomerView
为主模块,负责菜单的显示和处理用户操作。
CustomerList
为
Customer
对象的管理模块,内部用数组管理一组
Customer
对象,并提供相应的添加、修改、删除
和
遍历
方法
,供
CustomerView
调用。
Customer
为实体对象,用来封装客户信息。用bean来封装
首先是公开类
public class Customer
private String name;//客户姓名
private char gender;//性别
private int age;//年龄
private String phone;//电话号码
private String email;//电子邮箱
获取属性值的方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public char getGender() {
return gender;
}
public void setGender(char gender) {
this.gender = gender;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
创建构造器
public Customer() {//空参构造器
}
public Customer(String name, char gender, int age, String phone, String email) {
this.name = name;
this.gender = gender;
this.age = age;
this.phone = phone;
this.email = email;
}