客户信息管理软件系统

article/2025/10/23 5:16:38

拟实现一个基于文本界面的《客户信息管理软件》

进一步掌握编程技巧和调试技巧,熟悉面向对象编程

主要涉及以下知识点:

        ▶类结构的使用:

        ▶对象的创建与使用

        ▶类的封装性

        ▶声明和使用数组

        ▶数组的插入、删除和替换

        ▶关键字的使用:this

import java.util.*;
/**
* CMUtility工具类:
* 将不同的功能封装为方法,就是可以直接通过调用方法使用它的功能,而无需考虑具体的功能实现细节。
*/
public class CMUtility {private static Scanner scanner = new Scanner(System.in);/**用于界面菜单的选择。该方法读取键盘,如果用户键入’1’-’5’中的任意字符,则方法返回。返回值为用户键入字符。*/public static char readMenuSelection() {char c;for (; ; ) {String str = readKeyBoard(1, false);c = str.charAt(0);if (c != '1' && c != '2' && c != '3' && c != '4' && c != '5') {System.out.print("选择错误,请重新输入:");} else break;}return c;}/**从键盘读取一个字符,并将其作为方法的返回值。*/public static char readChar() {String str = readKeyBoard(2, false);return str.charAt(0);}/**从键盘读取一个字符,并将其作为方法的返回值。如果用户不输入字符而直接回车,方法将以defaultValue 作为返回值。*/public static char readChar(char defaultValue) {String str = readKeyBoard(2, true);return (str.length() == 0) ? defaultValue : str.charAt(0);}/**从键盘读取一个长度不超过2位的整数,并将其作为方法的返回值。*/public static int readInt() {int n;for (; ; ) {String str = readKeyBoard(2, false);try {n = Integer.parseInt(str);break;} catch (NumberFormatException e) {System.out.print("数字输入错误,请重新输入:");}}return n;}/**从键盘读取一个长度不超过2位的整数,并将其作为方法的返回值。如果用户不输入字符而直接回车,方法将以defaultValue 作为返回值。*/public static int readInt(int defaultValue) {int n;for (; ; ) {String str = readKeyBoard(2, true);if (str.equals("")) {return defaultValue;}try {n = Integer.parseInt(str);break;} catch (NumberFormatException e) {System.out.print("数字输入错误,请重新输入:");}}return n;}/**从键盘读取一个长度不超过limit的字符串,并将其作为方法的返回值。*/public static String readString(int limit) {return readKeyBoard(limit, false);}/**从键盘读取一个长度不超过limit的字符串,并将其作为方法的返回值。如果用户不输入字符而直接回车,方法将以defaultValue 作为返回值。*/public static String readString(int limit, String defaultValue) {String str = readKeyBoard(limit, true);return str.equals("")? defaultValue : str;}/**用于确认选择的输入。该方法从键盘读取‘Y’或’N’,并将其作为方法的返回值。*/public static char readConfirmSelection() {char c;for (; ; ) {String str = readKeyBoard(1, false).toUpperCase();c = str.charAt(0);if (c == 'Y' || c == 'N') {break;} else {System.out.print("选择错误,请重新输入:");}}return c;}private static String readKeyBoard(int limit, boolean blankReturn) {String line = "";while (scanner.hasNextLine()) {line = scanner.nextLine();if (line.length() == 0) {if (blankReturn) return line;else continue;}if (line.length() < 1 || line.length() > limit) {System.out.print("输入长度(不大于" + limit + ")错误,请重新输入:");continue;}break;}return line;}
}
public class Customer {private String name;private char gender = '男';private int age;private String phone;private String email;public  void setName(String name) {this.name = name;}public String getName() {return name;}public void setGender(char gender) {this.gender = gender;}public char getGender() {return gender;}public void setAge(int age) {this.age = age;}public int getAge() {return age;}public void setPhone(String phone) {this.phone = phone;}public String getPhone() {return phone;}public void setEmail(String email) {this.email = email;}public String getEmail() {return email;}//测试public static void main(String[] args) {Customer a = new Customer();a.setAge(28);a.setEmail("3466@qq.com");a.setGender('女');a.setName("张三");a.setPhone("10086");System.out.println(a.age+" "+a.email+" "+a.gender+" "+a.name+" "+a.phone);}}
public class CustomerList {private int total = 0;private Customer[] customers;private int totalCustomer;public int getTotalCustomer() {return totalCustomer;}/*** 用于初始化用户信息数组* @param totalCustomer */public CustomerList(int totalCustomer) {this.totalCustomer = totalCustomer;customers = new Customer[totalCustomer];}/*** 用于增加新的客户* @param customer 新增客户的信息* @return 提示增加客户是否成功*/public boolean addCustomer(Customer customer) {if(total < customers.length) {customers[total] = customer;this.total++;return true;}return false;}/*** 用途修改指定客户信息* @param index 客户索引* @param cust 用于替换的客户信息* @return 提示替换是否成功*/public boolean replaceCustomer(int index, Customer cust) {if(index < 0||index >= total) return false;if(customers[index] == null) return false;else{customers[index].setAge(cust.getAge() == -1?customers[index].getAge():cust.getAge());customers[index].setEmail(cust.getEmail() == null?customers[index].getEmail():cust.getEmail());customers[index].setGender(cust.getGender() == ' '?customers[index].getGender():cust.getGender());customers[index].setName(cust.getName() == null?customers[index].getName():cust.getName());customers[index].setPhone(cust.getPhone() == null?customers[index].getPhone():cust.getPhone());}return true;}/*** 用于删除指定客户* @param index 客户索引* @return 提示删除是否成功*/public boolean deleteCustomer(int index) {if(index < 0||index >= total) return false;if(customers[index] == null) return false;else {for(int i = index; i < total; i++) {customers[i] = customers[i+1];}}total--;return true;}/*** 用于获取全部客户* @return 返回所有客户列表*/public Customer[] getAllCustomer() {Customer[] allCustomer = new Customer[total];for(int i = 0; i < total; i++) { allCustomer[i] = customers[i];}return allCustomer;}/*** 获取指定客户* @param index 客户索引* @return 返回指定客户信息*/public Customer getCustomer(int index) {if(index < 0||index >= total) return null;return customers[index];}/*** 用于获取计入客户的个数* @return 返回计入的客户个数*/public int getTotal(){return total;}//测试public static void main(String[] args) {CustomerList customerList = new CustomerList(5);Customer a = new Customer();Customer b = new Customer();Customer c = new Customer();Customer d = new Customer();//Customer e = new Customer();//Customer f = new Customer();a.setAge(28);a.setEmail("3466@qq.com");a.setGender('F');a.setName("张三");a.setPhone("10086");b.setAge(22);b.setEmail("12345@qq.com");b.setGender('M');b.setName("李四");b.setPhone("10001");boolean test1 = customerList.replaceCustomer(0, a);boolean test2 = customerList.deleteCustomer(0);boolean test3 = customerList.replaceCustomer(-1, a);boolean test4 = customerList.deleteCustomer(-1);Customer test5 = customerList.getCustomer(-1);boolean test6 = customerList.addCustomer(b);System.out.println(customerList.total);boolean test7 = customerList.deleteCustomer(3);boolean test8 = customerList.deleteCustomer(0);boolean t1 = customerList.addCustomer(a);boolean t2 = customerList.addCustomer(b);boolean t3 = customerList.addCustomer(c);boolean t4 = customerList.addCustomer(d);boolean t5 = customerList.deleteCustomer(2);boolean t6 = customerList.deleteCustomer(0);System.out.println(test1+" "+ test2+" "+ test3+" "+ test4+" "+ test5+" "+test6+" "+ test7+" "+test8);System.out.println(t1+" "+t2+" "+t3+" "+t4+" "+t5+" "+t6+" ");Customer[] allCustomer = new Customer[0];allCustomer = customerList.getAllCustomer();System.out.println(allCustomer.length);System.out.println(allCustomer[0].getName());}}
public class CustomerView {CustomerList customerList = new CustomerList(10);//public void enterMainMenu() {CustomerView customerView = new CustomerView();abc: while (true) {try {Thread.sleep(300);System.out.println("--------------客户信息管理软件---------------");System.out.println("\n\t\t 1 添 加 用 户");System.out.println("\t\t 2 修 改 用 户");System.out.println("\t\t 3 删 除 客 户");System.out.println("\t\t 4 客 户 列 表");System.out.println("\t\t 5 退          出");System.out.println("\n\t\t 请选择 (1-5):__");char num = CMUtility.readMenuSelection();switch (num) {case '1':customerView.addNewCustomer();break;case '2':customerView.modifyCustomer();break;case '3':customerView.deleteCustomer();break;case '4':customerView.listAllCustomers();break;case '5':System.out.println("正在退出...");break abc;default:break;}} catch (InterruptedException e) {e.printStackTrace();}}System.out.println("已退出,祝你生活愉快");}/*** 添加客户*/private void addNewCustomer() {if (customerList.getTotal() >= customerList.getTotalCustomer()) {System.out.println("客户数量已满,无法添加,即将返回主菜单...");return;}System.out.println("-----------------添加客户------------------");Customer newCust = new Customer();System.out.print("姓名:");newCust.setName(CMUtility.readString(10));// System.out.println();System.out.print("性别:");newCust.setGender(CMUtility.readChar());// System.out.println();System.out.print("年龄:");newCust.setAge(CMUtility.readInt());// System.out.println();System.out.print("电话:");newCust.setPhone(CMUtility.readString(15));// System.out.println();System.out.print("邮箱:");while (true) {String str = CMUtility.readString(20);String emailMatcher = "[0-9A-Za-z]+@[0-9A-Za-z]+\\.[0-9A-Za-z]+";if(!str.matches(emailMatcher)) {System.out.println("邮箱不合法,请重新输入");continue;}newCust.setEmail(str);break;}// System.out.println();if (customerList.addCustomer(newCust)) {System.out.println("-----------------添加成功------------------");System.out.println("正在返回主菜单...");};}/*** 修改客户*/private void modifyCustomer() {if (customerList.getTotal() == 0) {System.out.println("当前无可修改的客户信息,即将返回主菜单...");return;}System.out.println("-----------------修改客户------------------");Customer cust = new Customer();int index = 0;for (;;) {System.out.println("请选择待修改客户编号(-1退出):");index = CMUtility.readInt();if (index == -1) {System.out.println("正在返回...");return;}if (index >= customerList.getTotal()) {System.out.println("无该编号的客户");continue;}break;}Customer oldcust = customerList.getCustomer(index);System.out.println("请在后方修改,直接回车则保持原状。");System.out.print("姓名(" + oldcust.getName() + "):");cust.setName(CMUtility.readString(20, null));System.out.print("性别(" + oldcust.getGender() + "):");cust.setGender(CMUtility.readChar(' '));System.out.print("年龄(" + oldcust.getAge() + "):");cust.setAge(CMUtility.readInt(-1));System.out.print("电话(" + oldcust.getPhone() + "):");cust.setPhone(CMUtility.readString(15, null));System.out.print("邮箱(" + oldcust.getEmail() + "):");while (true) {String str = CMUtility.readString(20,null);if(str == null) {cust.setEmail(null);break;}String emailMatcher = "[0-9A-Za-z]+@[0-9A-Za-z]+\\.[0-9A-Za-z]+";if(!str.matches(emailMatcher)) {System.out.println("邮箱不合法,请重新输入:");continue;}cust.setEmail(str);}if (customerList.replaceCustomer(index, cust)) {System.out.println("-----------修改结束-------------");System.out.println("正在返回主菜单...");};}/*** 删除客户*/private void deleteCustomer() {if(customerList.getTotal() == 0) {System.out.println("当前无可操作的客户,即将返回主菜单...");return;}System.out.println("-----------------删除客户------------------");System.out.println("请选择待删除客户编号(-1退出):");int index = 0;while (true) {index = CMUtility.readInt();if (index == -1) {System.out.println("正在返回...");return;} else if (index < 0 || index >= customerList.getTotal()) {System.out.println("该用户不存在,请重新输入...");continue;}break;}System.out.println("确认是否删除客户“"+customerList.getCustomer(index).getName()+"”(Y/N):");switch (CMUtility.readConfirmSelection()) {case 'Y':customerList.deleteCustomer(index);System.out.println("-----------------删除成功------------------");break;case 'N':System.out.println("-----------------取消操作------------------");break;}System.out.println("正在返回主菜单...");}/*** 展示所有客户信息*/private void listAllCustomers() {System.out.println("-----------------客户列表------------------");Customer[] allCustomer;allCustomer = customerList.getAllCustomer();System.out.println("编号\t姓名\t性别\t年龄\t电话\t\t邮箱");for (int i = 0; i < customerList.getTotal(); i++) {System.out.println(i + "\t" + allCustomer[i].getName() + "\t" + allCustomer[i].getGender() + "\t"+ allCustomer[i].getAge() + "\t" + allCustomer[i].getPhone() + "\t" + allCustomer[i].getEmail());}CMUtility.readChar(' ');System.out.println("----------------客户列表完成-----------------");System.out.println("正在返回主菜单...");}//程序入口public static void main(String[] args) {CustomerView customerView = new CustomerView();customerView.enterMainMenu();}
}


http://chatgpt.dhexx.cn/article/1NVSdFin.shtml

相关文章

企业如何通过CRM系统有效触达客户,获取潜在商机

“守株待兔”式坐等客户上门的时代了已经过去了&#xff0c;尤其是在存量时代&#xff0c;企业想要提高销售&#xff0c;扩大客源&#xff0c;就要不断的通过各种渠道来去拓展自己的客户和销路&#xff0c;而互联网时代&#xff0c;获客的渠道也丰富多样&#xff0c;企业选择好…

呼叫中心系统接入CRM客户管理系统

呼叫中心是企业与客户建立联系的桥梁&#xff0c;企业想要发展必须要有统一的客户管理系统&#xff0c;呼叫中心与客户管理系统对接到一起能够更高效管理客户&#xff0c;档案数据更准确。 在以前企业都是通过纸质的客户档案管理客户的&#xff0c;寻找某个客户时特别不方便&am…

CRM管理系统、教育后台、赠品管理、优惠管理、预约管理、试听课、教师、学生、客户、学员、商品管理、科目、优惠券、完课回访、客户管理系统、收费、退费、回访、账号权限、订单流水、Axure原型、rp原型

CRM管理系统、教育后台、赠品管理、优惠管理、预约管理、试听课、教师、学生、客户、学员、商品管理、科目、优惠券、完课回访、客户管理系统、收费、退费、回访、账号权限、订单流水、Axure原型、rp原型 Axure原型演示及下载地址&#xff1a;https://www.pmdaniu.com/storage…

在线云客服管理系统、会话管理、访客管理、客户管理、工单管理、会话记录、考勤统计、数据报表、工单设置、全局设置、转人工服务、自动回复、客户标签、客服监控、客服系统、前端会话、客服管理、在线客服、人工客服

在线云客服管理系统、会话管理、访客管理、客户管理、工单管理、会话记录、考勤统计、数据报表、工单设置、全局设置、转人工服务、自动回复、客户标签、客服监控、客服系统、前端会话、客服管理、在线客服 、人工客服 Axure原型演示及下载地址&#xff1a;Untitled Documenth…

CRM管理系统、教育后台、赠品管理、优惠管理、预约管理、试听课、教师、学生、客户、学员、商品管理、科目、优惠券、完课回访、客户管理系统、收费、退费、回访、账号权限、订单流水、审批、转账、rp原型

CRM管理系统、教育后台、赠品管理、优惠管理、预约管理、试听课、教师、学生、客户、学员、商品管理、科目、优惠券、完课回访、客户管理系统、收费、退费、回访、账号权限、订单流水、Axure原型、rp原型 Axure原型演示及下载地址&#xff1a;Untitled Documenthttps://f2b1hj…

客户管理系统

项目github地址&#xff1a;https://github.com/gh995836/crm 项目技术&#xff1a;SpringMVCSpringMybatisAjaxBootstrap 项目描述&#xff1a;该客户管理系统&#xff0c;前端采用Bootstrap框架 Ajax发送请求&#xff0c;后台采用JavaWeb的SpringMVCSpringMybatis框架进行…

“顾客总是对的”,客户满意从在线客服系统开始

"顾客总是对的"——马歇尔菲尔德 哈里戈登赛尔费里奇 毋庸置疑&#xff0c;赢得客户的青睐是维系自身经济长青的基础。想要客户满意&#xff0c;得到最佳的客户评价&#xff0c;企业就需要为客户提供超出他们期望的服务。 有人将客户服务分为三重境界:第一重境界&am…

一文读懂:客户管理系统平台是什么?有什么作用?

“客户管理系统平台是什么&#xff1f;” “客户管理系统平台有什么作用&#xff1f;在哪里可以应用&#xff1f;怎么用&#xff1f;” 经常可以听到企业内部关于客户管理系统平台的这些问题&#xff0c;本文将会为您一一解答&#xff1a; 一、客户管理系统平台是什么 顾名…

什么是客户自助服务门户及其搭建方法

随着信息技术的快速发展&#xff0c;越来越多的企业开始转向以客户为中心的服务模式&#xff0c;而客户自助服务门户&#xff08;Customer Self-Service Portal&#xff09;则成为了重要的服务方式。它可以让客户在不需要人工干预的情况下&#xff0c;自行解决问题&#xff0c;…

客户管理系统如何提升体验

数字化时代&#xff0c;客户与企业交互的触点爆炸式增长&#xff0c;客户体验正从单一触点走向端到端旅程。众多的产品、海量的数据&#xff0c;导致客户对体验的要求越来越多......CRM客户管理系统是企业提升客户体验的有效工具&#xff0c;它不仅可以帮助您进一步了解客户&am…

在线云客服管理系统、会话管理、访客管理、客户管理、工单管理、会话记录、考勤统计、数据报表、工单设置、全局设置、人工服务、自动回复、客户标签、客服监控、客服系统、前端会话、客服管理、在线客服 、人工客服

在线云客服管理系统、会话管理、访客管理、客户管理、工单管理、会话记录、考勤统计、数据报表、工单设置、全局设置、转人工服务、自动回复、客户标签、客服监控、客服系统、前端会话、客服管理、在线客服 、人工客服 Axure原型演示及下载地址&#xff1a;https://www.pmdani…

CRM客户管理系统

Sunsiny资产CRM客户管理系统 目录 一、 CRM系统背景 2 二、 CRM系统分类 3 三、概述 3 四、系统的技术选型 3 五、 系统模块简介 4 六、 领导驾驶舱 6 七、 客户经理驾驶舱 6 八、 客户管理 7 九、 联系人管理 8 十、 服务记录 8 十一、 公出计划 8 十二、 资管产品 9 十三、 …

CRM系统针对性的解决方案—客户管理一体化

CRM&#xff08;Customer Relationship Management&#xff09;是客户关系管理系统的英文简称。CRM系统以客户为中心&#xff0c;以信息技术为手段&#xff0c;实现营销、客户、销售、产品、服务等方面的信息化、自动化、一体化管控&#xff0c;帮助企业统一管理客户、满足个性…

保险客服系统之电子回访业务

电子回访业务就是人工回访的智能化&#xff0c;由机器人智能语音代替客服人员&#xff0c;人工回放指当客户在保险公司购买完保险之后&#xff0c;客服对客户进行的售后维护工作。其中最常见的就是新契约回访&#xff0c;就是在客户收到保险合同之后给客户去电话了解客户是否对…

客户信息管理系统

客户信息管理系统 课程设计的题目及简介设计说明程序流图程序清单Customer 类MainView类Tools类DataManager类 调试结果课程设计体会视频教程 课程设计的题目及简介 客户信息管理系统&#xff0c;功能如下&#xff1a; &#xff08;1&#xff09;添加客户信息 &#xff08;2&…

回访管理系统

背景 近年&#xff0c;国家在不断出台鼓励社会办医疗机构的一系列措施&#xff0c;积极推进社会办医&#xff0c;努力构建多元化医疗服务体系。但从去年下半年开始&#xff0c;相当比例的民营医院经营越来越困难&#xff0c;全国范围内很多民营医院的门诊量都在下降&#xff0c…

DNS解析域名解析过程

当我们在浏览器的地址栏输入网址的时候&#xff0c;其实输入的是一个URL的域名&#xff0c;而这个域名需要解析成为IP地址&#xff0c;才能让我们与远程的主机进行管理。而将URL解析成为IP&#xff0c;就变得至关重要&#xff0c;这一过程就是DNS解析的过程。如果没有DNS解析&a…

一张图看懂DNS域名解析全过程

DNS域名解析是互联网上非常重要的一项服务&#xff0c;上网冲浪&#xff08;还有人在用这个词吗&#xff1f;&#xff09;伴随着大量DNS服务来支撑&#xff0c;而对于网站运营来说&#xff0c;DNS域名解析的稳定可靠&#xff0c;意味着更多用户的喜欢&#xff0c;更好的SEO效果…

【计算机网络】DNS域名解析过程

关于DNS域名解析大致过程如图&#xff1a; 当一个用户在地址栏输入www.csdn.net时&#xff0c;DNS解析大致有如下十个过程&#xff1a; 浏览器先检查自身缓存中有没有被解析过的这个域名对应的ip地址&#xff0c;如果有&#xff0c;解析结束。同时域名被缓存的时间也可通过TTL属…

域名系统DNS及域名解析过程

域名系统DNS 域名系统DNS是互联网使用的命名系统&#xff0c;用来把便于人们使用的机器名字转换为IP地址。 在早期整个网络上只有数百台计算机&#xff0c;那时使用一个叫做hosts的文件&#xff0c;列出所有主机名字和相应的IP地址。只要用户输入一台主机名字&#xff0c;计算…