How to realize customer Information Management system with Java
这篇文章主要讲解了"Java怎么实现客户信息管理系统",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Java怎么实现客户信息管理系统"吧!
Customer类:
public class Customer { /** * @name 客户姓名 * @sex 性别 * @age 年龄 * @phone 电话号码 * @email 邮箱 */ private String name; private String sex; private int age; private String phone; private String email; public Customer(){}; public Customer(String name,String sex,int age,String phone,String email){ this.name=name; this.sex=sex; this.age=age; this.phone=phone; this.email=email; } public String getName(){ return this.name; } public void setName(String name){ this.name=name; } public String getSex(){ return this.sex; } public void setSex(String sex){ this.sex=sex; } public String getPhone(){ return phone; } public void setPhone(String phone){ this.phone=phone; } public int getAge(){ return this.age; } public void setAge(int age){ this.age=age; } public String getEmail(){ return this.email; } public void setEmail(String email){ this.email=email; }}
CustomerList 类:
public class CustomerList { private Customer [] customers; private static int total = 0; /** * 构造器初始化对象数组 * @param totalCustmoers 客户的总数 */ public CustomerList(int totalCustmoers){ customers = new Customer[totalCustmoers]; } /** * 增加客户 * @param customer 客户 * @return 返回是否添加成功 */ public boolean addCustomer(Customer customer){ if(customer!=null&&total=0 && index