//先创建超市会员实体类
package marketVIP;import java.text.SimpleDateFormat;
import java.util.Date;public class MarketVIP {private String name;private int cardNum;private int password;private int VIPscore;private String cardDate;public String getName() {return name;}public void setName(String name) {this.name = name;}public int getCardNum() {return cardNum;}public void setCardNum(int cardNum) {this.cardNum = cardNum;}public int getPassword() {return password;}public void setPassword(int password) {this.password = password;}public int getVIPscore() {return VIPscore;}public void setVIPscore(int vIPscore) {VIPscore = vIPscore;}public String getCardDate() {return cardDate;}public void setCardDate(String cardDate) {this.cardDate = cardDate;}public MarketVIP() {super();}public MarketVIP(String name, int password) {super();this.name = name;this.cardNum = (int) (Math.random()*90000000+10000000);this.password = password;
//      初始化会员积分给100VIPscore = 100;//创建日期对象Date date = new Date(); //定制日期格式SimpleDateFormat formater = new SimpleDateFormat("yyyy- MM-dd HH:mm:ss");String now = formater.format(date);this.cardDate = now;}}//测试类
package marketVIP;import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;public class Test {public static void main(String[] args) {// TODO Auto-generated method stubList<MarketVIP> marketList=new ArrayList<>();Scanner input = new Scanner(System.in);do {
//          界面初始化System.out.println("*************************欢迎进入超市会员管理系统***************************************");System.out.println("1.积分累计\t" + "2. 积分兑换\t" + "3. 查询剩余积分" + "4. 修改密码" + "5. 开卡" + "6. 退出");System.out.println("******************************************************");System.out.println("请选择:");int a = input.nextInt();switch (a) {case 1:System.out.println("请输入你的会员卡号:");int num=input.nextInt();System.out.println("请输入你的会员卡密码:");int passwordone=input.nextInt();//做一个判断标记符boolean IsExist=false;for (int i = 0; i < marketList.toArray().length; i++) {if (num==marketList.get(i).getCardNum() && passwordone==marketList.get(i).getPassword()) {System.out.println("请输入您此次消费金额(消费1元累计1分):");int money=input.nextInt();marketList.get(i).setVIPscore(marketList.get(i).getVIPscore()+money);System.out.println("积分累计成功!");IsExist=true;break;}}if (!IsExist) {System.out.println("您输入的会员卡号或密码错误,无法累积积分");System.out.println("积分累计失败!");}continue;case 2:System.out.println("请输入你的会员卡号:");int num2=input.nextInt();System.out.println("请输入你的会员卡密码:");int password2=input.nextInt();boolean IsExist2=false;for (int i = 0; i < marketList.toArray().length; i++) {if (num2==marketList.get(i).getCardNum() && password2==marketList.get(i).getPassword()) {System.out.println("请输入您需要兑换使用的积分(100积分抵用0.1元,不足100的积分不做抵用)");int score2=input.nextInt();if (marketList.get(i).getVIPscore()>=100) {IsExist2=true;if (marketList.get(i).getVIPscore()>=score2) {System.out.println("您的消费金额中使用会员积分抵消"+score2*0.001+"元");System.out.println("积分兑换成功!");
//                              改变真实积分值marketList.get(i).setVIPscore(marketList.get(i).getVIPscore()-score2);} else {System.out.println("您输入的积分大于你原有积分!!");}}else {IsExist2=false;}}}if (!IsExist2) {System.out.println("抱歉您的积分不够,无法抵用消费金额。");System.out.println("积分兑换失败!");}continue;case 3:System.out.println("请输入你的会员卡号:");int num3=input.nextInt();System.out.println("请输入你的会员卡密码:");int password3=input.nextInt();boolean Isexist3=false;for (int i = 0; i < marketList.toArray().length; i++) {if (num3==marketList.get(i).getCardNum() && password3==marketList.get(i).getPassword()) {Isexist3=true;System.out.println("姓名\t"+"会员卡号\t"+"剩余积分\t"+"开卡日期\t");System.out.println(marketList.get(i).getName()+"\t"+marketList.get(i).getCardNum()+"\t"+marketList.get(i).getVIPscore()+"\t"+marketList.get(i).getCardDate());}}if (!Isexist3) {System.out.println("您输入的卡号或密码有误!!");}continue;case 4:System.out.println("请输入你的会员卡号:");int num4=input.nextInt();System.out.println("请输入你的会员卡密码:");int password4=input.nextInt();boolean IsExist4=false;for (int i = 0; i < marketList.toArray().length; i++) {if (num4==marketList.get(i).getCardNum() && password4==marketList.get(i).getPassword()) {System.out.println("请输入新的会员密码:");int newPsWord=input.nextInt();marketList.get(i).setPassword(newPsWord);System.out.println("密码修改成功!");IsExist4=true;}}if (!IsExist4) {System.out.println("您输入的卡号或密码有误!");}continue;case 5:System.out.println("请输入注册姓名:");String name=input.next();System.out.println("请输入注册密码");int password1=input.nextInt();MarketVIP marketVIP=new MarketVIP(name,password1);marketList.add(marketVIP);System.out.println("恭喜,开通会员卡成功,系统赠送您100积分!!您的会员卡号为:"+marketVIP.getCardNum());continue;case 6:System.out.println("感谢你的使用,欢迎下次使用!!");break;}break;} while (true);}}

运行结果功能实现

java08-集合框架实现超市会员管理系统相关推荐

  1. Java 使用Map集合 写出超市会员管理系统

    首先我们要写出该会员的一系列属性和它的有参无参构造方法和封装方法 public class Member {private String name;private int Card;private S ...

  2. 超市会员管理系统(对象+集合)

    项目需求          为某超市开发一个超市会员管理系统,实现会员的管理,具体实现功能如下: (1)积分累计 (2)积分兑换 (3)查询剩余积分 (4)查询所有会员信息 (5)修改密码 (6)开卡 ...

  3. JAVA小项目之超市会员管理系统

    思路分析 1.会员类Member     (1)姓名        name:String     (2)卡号        cardId:int     (3)密码        password: ...

  4. 基于SSM的超市会员管理系统

    项目名称:基于SSM的超市会员管理系统(cshy_sys) 前端技术:H-ui.HTML.CSS.JS.JQuery等 后端技术:JSP.SSM框架 运行环境:Windows10以上.JDK1.8 数 ...

  5. 基于Spring MVC + Spring + MyBatis的【超市会员管理系统】

    资源下载: https://download.csdn.net/download/weixin_44893902/22035329 一. 语言和环境 实现语言:JAVA语言. 使用:MyEclipse ...

  6. Spring+SpringMVC+mybatis基于ssm的超市会员管理系统

    项目编号:jsp244ssm超市会员管理系统 运行环境: 开发工具:IDEA /Eclipse 数据库:MYSQL5.7 应用服务:Tomcat7/Tomcat8 使用框架:Spring+Spring ...

  7. 带你深入了解Java!十七、超市会员管理系统!

    < 超市会员管理系统 > 效果图 实现超市会员管理系统 分析实体 会员类:Vip 会员用户名: String name: 会员卡号: int id 会员密码:String password ...

  8. 超市会员管理系统实战项目

    //超市会员类 public class Member {//姓名 卡号 卡密 积分 开卡日期private String name;private int cardId;private String ...

  9. 基于JSP的超市会员管理系统毕业设计

    技术:Java.JSP等 摘要: 科学技术的不断提高,计算机科学日渐成熟,其强大的功能已被人们深刻的认识,它已进入人类社会的各个领域并发挥着越来越重要的作用.它已经深入到日常工作及生活的方方面面,比如 ...

最新文章

  1. python3 多级目录建立 os.makedirs()
  2. 揭开知识库问答KB-QA的面纱2·语义解析篇
  3. VTK:可视化之LODProp3D
  4. xml.etree ElementTree简介
  5. ASP.NET实现下载的中文文件名乱码处理
  6. 【信号与系统】系统特性
  7. 【CodeForces - 460C】Present(二分+树状数组)
  8. LAMP下http跳转到 https
  9. 在使用Vs2013打开Vs2008的解决方案时出现了以下错误:此版本的应用程序不支持其项目类型(.csproj)...
  10. AppBox v6.0中实现子页面和父页面的复杂交互
  11. Spring集成Hprose
  12. 火狐浏览器安全连接失败解决办法
  13. 人工智能,这五个行业岗位未来很吃香
  14. Linux驱动快速入门
  15. EEG信号分析:关于时频分析方面的个人理解
  16. 压缩png命令cmd_PNG图片文件大小怎么改变
  17. 单片机经典外围电路(一)--LCD1602显示
  18. IEEE Access 上岸指南
  19. Adobe2021正式版,来了!
  20. MobaXterm x11-forwarding

热门文章

  1. FFmpeg基础到工程-多路H265监控录放开发学习笔记
  2. [Ubunut] c++段错误调试工具gdb的使用方法
  3. undefined reference to `_Unwind_Resume'
  4. 我的管理类联考考研经验分享
  5. 上海交通大学方浩树:人类行为理解与机器人物体操作
  6. 微信按住说话HTML实现
  7. 省市县三级联动数据库
  8. 《写给大家看的设计书》为什么要学习这本书:
  9. 多叉树的python实现
  10. 哈哈日语 学日语 入门难?那是你用错了方法!