package S2.S2homework.s;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class MenberDao {
Scanner in=new Scanner(System.in);
List<Menber> list=new ArrayList<>();
public void menu(){
System.out.println("********欢迎来到青青网校积分商城********");
System.out.println("1.注册\t2.积分累计\t3.积分兑换\t4.积分查询\t5.修改密码\t6.购买\t7.退出");
System.out.println("**********************************");
System.out.println("请输入你的选择:");
}
public void register(){
Menber menber=new Menber();
System.out.println("请输入你的注册姓名:");
menber.setName(in.next());
System.out.println("请输入你的注册密码:");
Random rand=new Random();
int created=rand.nextInt(80000000);
menber.setCardid(created);
String pwd;
boolean falg=true;
do {
pwd = in.next();
if (pwd.length() < 6) {
System.out.println("密码小于六位,请重新输入!");
falg = false;
}
else {
falg=true;
menber.setPassword(pwd);
}
}while (!falg);
menber.setJifen(100);
LocalDate localDate=LocalDate.now();
DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyy年MM月dd日");
menber.setTime(dateTimeFormatter.format(localDate));
list.add(menber);
System.out.println("恭喜!注册成功,系统赠送一百积分,你的编号为:"+menber.getCardid()+"注册日期为:"+menber.getTime());
}
public Menber hasmenber(Menber menber){
if (menber.getPassword()!=null){
for (int i=0;i<list.size();i++){
if (list.get(i).getCardid()==menber.getCardid()&&list.get(i).getPassword().equals(menber.getPassword())) {
return list.get(i);
}
}
}else {
for (int i=0;i<list.size();i++){
if (list.get(i).getCardid()==menber.getCardid()){
return list.get(i);
}
}
}
return null;
}
public void buy() {
List<book> list = new ArrayList<>();
Menber menber = new Menber();
book book = new book();
list.add(new book("西游记", 200, "1001", 10));
list.add(new book("红楼梦", 150, "1002", 20));
list.add(new book("大话西游", 20, "1003", 3));
list.add(new book("神话", 30, "1004", 30));
list.add(new book("剑来", 500, "1005", 4));
list.add(new book("遮天", 300, "1006", 40));
list.add(new book("龙族", 999, "1007", 50));
list.add(new book("完美世界", 100, "1008", 60));
for (book b : list) {
System.out.println("书名为:" + b.getName() + ",价格:" + b.getPrice() + ",编号为:" + b.getBianhao());
}
System.out.println("请输入你的会员编号:");
menber.setCardid(in.nextInt());
System.out.println("请输入你的会员密码:");
menber.setPassword(in.next());
if ((menber = hasmenber(menber)) != null) {
boolean b = true;
do {
boolean bb = true;
System.out.println("请输入你要购买的编号:");
String bianhao=in.next();
for (int i = 0; i < list.size(); i++) {
if (bianhao.equals(list.get(i).getBianhao())) {
System.out.println("请输入你要购买的数量");
int aa = in.nextInt();
int jia = aa * list.get(i).getPrice();
if (jia > menber.yue) {
System.out.println("余额不足");
break;
} else {
menber.yue -= menber.yue - aa;
list.get(i).setKucun(list.get(i).getKucun() - aa);
menber.setJifen(menber.yue);
}
System.out.println("是否继续");
if (in.next().equals("y")) {
return;
} else {
b = false;
}
}
if (bb = true) {
System.out.println("请输入正确的编号");
b = false;
}
}
} while (!b);
}else {
System.out.println("登录失败");
}
}
public Boolean saveScore(){
Menber menber=new Menber();
System.out.println("请输入你的会员编号:");
menber.setCardid(in.nextInt());
System.out.println("请输入你的会员密码:");
menber.setPassword(in.next());
if ((menber=hasmenber(menber))!=null){
System.out.println("请输入您的此次消费金额(消费1元累计一积分)");
int socre=in.nextInt();
menber.setJifen(socre);
return true;
}else {
System.out.println("您的输入有误请重新输入!");
}
return false;
}
public boolean minusScore(){
Menber menber=new Menber();
System.out.println("请输入你的会员编号:");
menber.setCardid(in.nextInt());
System.out.println("请输入你的会员密码:");
menber.setPassword(in.next());
if ((menber=hasmenber(menber))!=null){
System.out.println("您的当前积分是;"+menber.getJifen());
System.out.println("请输入您需要兑换使用的积分(100积分抵用1元,不足100的积分不做抵用):");
int score=in.nextInt();
if (score<100){
System.out.println("输入的积分不能小于100");
return false;
}else if (score<= menber.getJifen()){
menber.setJifen(menber.getJifen()-score);
System.out.println("您本次兑换"+score/100+"元青碧,剩余积分为:"+menber.getJifen());
return true;
}else {
System.out.println("穷逼一个!");
}
}else {
System.out.println("您输入的账号密码不对");
}
return false; }
public void showScore() {
Menber menber = new Menber();
System.out.println("请输入你的会员编号:");
menber.setCardid(in.nextInt());
System.out.println("请输入你的会员密码:");
menber.setPassword(in.next());
if ((menber = hasmenber(menber)) != null) {
System.out.println("姓名\t会员编号\t剩余积分\t注册日期");
System.out.println(menber.getName()+"\t"+menber.getCardid()+"\t"+menber.getJifen()+"\t"+menber.getTime());
}else {
System.out.println("您的输入有误,无法查询");
}
}
public void changePwd(){
Menber menber = new Menber();
System.out.println("请输入你的会员编号:");
menber.setCardid(in.nextInt());
System.out.println("请输入你的会员密码:");
menber.setPassword(in.next());
if ((menber = hasmenber(menber)) != null) {
System.out.println("请输入新的会员密码:");
boolean b=true;
do {
String pwd=in.next();
if (pwd.length()<6){
System.out.println("会员密码�
没有合适的资源?快使用搜索试试~ 我知道了~
那些年经历过风雨敲过的代码
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共425个文件
class:210个
java:204个
xml:6个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 0 1 下载量 186 浏览量
2022-09-03
15:56:36
上传
评论
收藏 275KB ZIP 举报
温馨提示
那些年经历过风雨敲过的代码
资源详情
资源评论
资源推荐
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 425 条
- 1
- 2
- 3
- 4
- 5
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/9712520934d84bdeb98293ba7fe8d4fe_m0_69761871.jpg!1)
穿着夹板鞋的张三
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- (大赛作品)STM32实现的F072RB NUCLEO智能家居控制.zip
- STM32实现的数字示波器源码+数字信号处理教程、配套实例.zip
- 【cookie续续】【cookie续续】【cookie续续】
- 低功耗STM32实现的F411开发板(原理图+PCB源文件+官方例程+驱动等).zip
- 基于stm32实现的 nucleo-L476的智能灯(操作说明+源码).zip
- 基于STM32实现的 NUCLEO板设计彩色LED照明灯(纯cubeMX开发).zip
- 基于STM32实现的 的联合调试侦听设备解决方案(原理图、PCB源文件、调试工具、视频).zip
- 基于STM32实现的 人群定位、调速智能风扇设计(程序、设计报告、视频演示).zip
- 哔哩下载姬(DownKyi)
- 千纬认字app再次更新,增加部首、笔画动画功能
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0