
00010.02最基础客户信息管理软件(意义类的小项目,练习基础,不涉及数据库)
������������������������ ������������������������������������ ��������������������������������������� ��������������������������������������� ���������������������������������
发布日期:2021-05-15 23:23:27
浏览次数:7
分类:精选文章
本文共 4952 字,大约阅读时间需要 16 分钟。
���������������������������
������������������������������������Java������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
������������������
������������������������������������������������
1. ������������Bean���
- ������������������������������������������������������������������������
package com.atguigu.bean;public class Customer { private String name; private char gender; private int age; private String phone; private String email; 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; } //getter���setter������}
2. ������������������Service���
- ������������������������������������������������������������������������������������
package com.atguigu.service;import com.atguigu.bean.Customer;public class CustomerService { private Customer[] all; private int total; public CustomerService() { all = new Customer[2]; } public void addCustomer(Customer customer) { if (total >= all.length) { System.out.println("������������"); return; } all[total++] = customer; }}
3. ������������View���
- ������������������������������������������������������������������������������������
package com.atguigu.view;import com.atguigu.bean.Customer;import com.atguigu.utils.CMUtility;import com.atguigu.service.CustomerService;public class CustomerView { private CustomerService service = new CustomerService(); public void menu() { System.out.println("------������������������������-----------"); System.out.println("1���������������"); System.out.println("2���������������"); System.out.println("3���������������"); System.out.println("4���������������������"); System.out.println("5���������������"); System.out.println("������������������1-5������"); char choice = CMUtility.readMenuSelection(); switch (choice) { case '1': addCustomer(); break; case '2': editCustomer(); break; case '3': deleteCustomer(); break; case '4': listCustomers(); break; case '5': logout(); break; } }}
������������������
1. ������������
public void addCustomer() { System.out.println("-------������������---------"); System.out.print("��������� "); String name = CMUtility.readString(20); System.out.print("��������� "); char gender = CMUtility.readChar(); System.out.print("��������� "); int age = CMUtility.readInt(); System.out.print("��������� "); String phone = CMUtility.readString(11); System.out.print("��������� "); String email = CMUtility.readString(32); Customer customer = new Customer(name, gender, age, phone, email); service.addCustomer(customer); System.out.println("-------------������������-------------"); menu();}
2. ������������
public void deleteCustomer() { System.out.println("-------------������������-----------------------"); System.out.println("������������������������������������-1������������ "); int id = CMUtility.readInt(); if (id == -1) { return; } System.out.print("���������������Y/N������ "); char confirm = CMUtility.read ConfirmSelection(); if (confirm != 'Y') { menu(); return; } service.removeById(id); System.out.println("-------------������������-----------------------"); menu();}
3. ������������������
public void listCustomers() { System.out.println("--------������������--------------"); System.out.println("������ ������ ������ ������ ������ ������"); Customer[] customers = service.getAll(); for (int i = 0; i < customers.length; i++) { System.out.println((i + 1) + "\t" + customers[i].getInfo()); } System.out.println(); System.out.println("-------------������������������-----------------------"); menu();}
���������������
1. ������������
- ���������IntelliJ IDEA
- ���������
- ������������������������������������������
- ������������������������Debugger������������������
- ������������������������������������������
2. ���������
package com.atguigu.test;import com.atguigu.view.CustomerView;public class Test { public static void main(String[] args) { CustomerView view = new CustomerView(); view.menu(); }}
������������������
������
���������������������������������������������������������������������������������������������Java������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关注你微信了!
[***.104.42.241]2025年04月08日 00时19分07秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
C语言编译错误列表
2021-05-10
看明白这两种情况,才敢说自己懂跨链! | 喵懂区块链24期
2021-05-10
张一鸣:创业7年,我经历的5件事
2021-05-10
《web安全入门》(四)前端开发基础Javascript
2021-05-10
python中列表 元组 字典 集合的区别
2021-05-10
python struct 官方文档
2021-05-10
Android DEX加固方案与原理
2021-05-10
iOS_Runtime3_动态添加方法
2021-05-10
Leetcode第557题---翻转字符串中的单词
2021-05-10
Problem G. The Stones Game【取石子博弈 & 思维】
2021-05-10
Unable to execute dex: Multiple dex files
2021-05-10
Java多线程
2021-05-10
Unity监听日记
2021-05-10
openssl服务器证书操作
2021-05-10
expect 模拟交互 ftp 上传文件到指定目录下
2021-05-10
linux系统下双屏显示
2021-05-10
PDF.js —— vue项目中使用pdf.js显示pdf文件(流)
2021-05-10
我用wxPython搭建GUI量化系统之最小架构的运行
2021-05-10