学校,银行,酒店.....秩序的良好运行都离不开对相应客户信息的管理,在这里我们用Java代码实现简单的客户信息管理软件。主要操作有"1 添加客户"、"2 修改客户"、"3删除客户"、"4 客户列表"、"5 退出"
我们涉及到的知识储备也很基础:方法的调用、函数的声明与使用、对象的创建、实现与使用、权限修饰符的使用等等,一起来学习吧!
首先创建四个包:CMUtility、Customer、CustomerList、CustomerView
1.CMUtility包中声明CMUtility类,该类中定义了许多与用户交互的具体方法,不对外暴露,使用时直接调用即可,一般我们写代码时通常都会将与用户交互的方法定义在一个统一的工具类中方便管理调用
![](https://img-blog.csdnimg.cn/img_convert/4f3d5c57d84d768ab64ec6ede450c4db.png)
![](https://img-blog.csdnimg.cn/img_convert/733f764b39f8afdb834ffe082212e575.png)
![](https://img-blog.csdnimg.cn/img_convert/e52b43a611fda0567fd8c2b731bfb6dc.png)
.........
具体代码实现:https://gitcode.net/-/snippets/3142
2.Customer包中声明了Customer类,该类中声明了客户的各项属性,如果需要录入一位客户的信息就需要new 一个Customer类的对象
![](https://img-blog.csdnimg.cn/img_convert/5bbfa88020adb09012b2019b0013673a.png)
添加构造器,new对象的同时直接给对象赋予相应的属性值
![](https://img-blog.csdnimg.cn/img_convert/a3e6675f692e5660b21faf1d9df2135b.png)
提供相应属性的get set 方法,便于管理系统后台人员直接对用户信息的修改处理
具体代码实现:https://gitcode.net/-/snippets/3143
3.CustomerList包中声明了CustomerList类,该类中定义了一个数组用于储存用户信息,提供了用户信息的添加,删除,修改等的判断功能;同时提供了整个数组的get方法和数组的某个成员的get 方法,便于取得客户信息
![](https://img-blog.csdnimg.cn/img_convert/4681fe5da63f38b52c35083433ce427a.png)
![](https://img-blog.csdnimg.cn/img_convert/635bbd0cfe2297f337b9fa6e6ceaca4c.png)
具体代码实现:https://gitcode.net/-/snippets/3144
CustomerView包中声明了CustomerView,该类中提供了比较简单的程序管理菜单界面,同时定义了用户信息的添加,修改,删除方法,主界面根据用户选择情况用switch-case语句做出判断从而进行不同的操作,该类中需要用到与用户实际交互的操作,所以需要导入CMUtility包,引入CMUtility工具类,因为该类中的方法使用了static 修饰,则可以直接使用 类.方法名()来调用;需要CustomerList类中的一些判断方法和客户数组,需要new出相应的对象
![](https://img-blog.csdnimg.cn/img_convert/16b0e5fd207eace21411b2aa05f7c224.png)
![](https://img-blog.csdnimg.cn/img_convert/a88254f68f9d4f89caf527cf0c3360cc.png)
![](https://img-blog.csdnimg.cn/img_convert/983c3176867c03d7f94cbfb7a517ec5d.png)
具体代码实现:https://gitcode.net/-/snippets/3145
以上就是用java实现的简单的客户信息管理软件,希望对你的学习有所帮助,
有不足的地方希望可以及时指正,up也正在努力学习呀!
全部代码:
CMUtility :https://gitcode.net/-/snippets/3142
Customer :https://gitcode.net/-/snippets/3143
CustomerList :https://gitcode.net/-/snippets/3144
CustomerView :https://gitcode.net/-/snippets/3145