我行我素购物管理系统(部分功能)

这是一个简单的购物管理系统实现,包括客户登录、密码修改、购物结算和客户信息管理等功能。用户可以通过输入选择进行操作,如登录系统、查看或修改客户信息、购物结算等。系统还设有多个管理员账户供登录。
摘要由CSDN通过智能技术生成
import java.text.DecimalFormat;
import java.util.Scanner;

/**
 * 多个客户登录(已经成功)
 * 用户密码修改已经完成
 * 购物完成
 * 客户信息管理完成
 * 还可以完善
 * @author Administrator
 * 
 */
public class Shopping {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String[] name = new String[3];
		String[] psw = new String[3];
		name[0] = "admin";
		name[1] = "admin1";
		name[2] = "admin2";
		psw[0] = "admin";
		psw[1] = "admin1";
		psw[2] = "admin2";
		//定义客户信息数组
		//客户编号
		String []id=new String[3];
		id[0]="1001";
		id[1]="1002";
		id[2]="1003";
		//客户姓名
		String[] customerName=new String[3];
		customerName[0]="小猫";
		customerName[1]="小狗";
		customerName[2]="小马";
		//客户生日
		String []birthday=new String[3];
		birthday[0]="1993-01-19";
		birthday[1]="1992-01-19";
		birthday[2]="1991-01-19";
		//客户积分
		int[]score=new int[3];
		score[0]=1000;
		score[1]=2000;
		score[2]=3000;
		int j = 0;// 定义一个局部变量,方便取值(修改密码要用)
		// 控制小数点位数为一位
		DecimalFormat df = new DecimalFormat(
				"#.0");

		yiji: while (true) {
			System.out.println("\t\t\t欢迎使用我行我素购物管理系统");
			System.out
					.println("**************************************************************");
			System.out.println("\n\t\t\t1.登录系统");
			System.out.println("\n\t\t\t2.更改管理员密码");
			System.out.println("\n\t\t\t3.退出");

			System.out
					.println("**************************************************************");
			qiji: while (true) {
				System.out.println("请输入你的选择:");
				String choice = input.next();
				if (choice.equals("1")) {
					System.out
							.println("--------------------------------------------------------------");
					// 验证用户名和密码
					int loginIndex = 0;
					erji: while (true) {
						System.out.println("请输入用户名:");
						String userName = input.next();
						System.out.println("请输入密码:");
						String password = input.next();
						// 加一个循环便于多个客户登录系统
						for (j = 0; j < psw.length; j++) {
							if (name[j].equals(userName)
									&& psw[j].equals(password)) {
								System.out.println("成功登录");
								break erji;

							}
						}

						loginIndex++;
						if (loginIndex > 2) {
							System.out.println("你的机会已经用完了!警察叔叔会来找你的");
							System.exit(1);
						}

						System.out.println("对不起,你的用户名或者密码有误,你还有"
								+ (3 - loginIndex) + "次机会");
						continue erji;

					}// 三级循环

					System.out.println("----------------------登录中-------------");
					erji: while (true) {
						System.out
								.println("**************************************************************");
						System.out.println("\t\t\t1,客户信息管理");
						System.out.println("\t\t\t2,购物结算");
						System.out.println("\t\t\t3,真情回馈");
						System.out.println("\t\t\t4,返回上一级");
						System.out
								.println("**************************************************************");
						baji: while (true) {
							System.out.println("请输入你的选择:");
							choice = input.next();
							// 对输入不存在的编号进行判断并进行处理
							if (!choice.equals("1")&&(!choice.equals("2"))&&(!choice.equals("3")&&(!choice.equals("4")))) {
								System.out.println("对不起,你的选择有误,请重新输入:");
								continue baji;
							}
							if (choice.equals("1")) {
								sanji: while (true) {
									System.
  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值