x_kai308 2017-09-14 02:36 采纳率: 0%
浏览 829

知道下标index怎么修改会员和积分

String a = "";
    custNo[0] = 1900;
    custNo[1] = 1711;
    custNo[2] = 1623;
    custNo[3] = 1545;
    custNo[4] = 1464;
    custNo[5] = 1372;
    custNo[6] = 1286;
    custNo[7] = 4444;

    custBirth[0] = "08/05";
    custBirth[1] = "07/13";
    custBirth[2] = "06/26";
    custBirth[3] = "04/08";
    custBirth[4] = "08/16";
    custBirth[5] = "12/23";
    custBirth[6] = "12/21";
    custBirth[7] = "05/06";

    custScore[0] = 2000;
    custScore[1] = 4000;
    custScore[2] = 5000;
    custScore[3] = 2200;
    custScore[4] = 1000;
    custScore[5] = 3000;
    custScore[6] = 10080;
    custScore[7] = 1000;
    System.out.println("我行我素购物管理系统 > 客户信息管理 > 修改客户信息\n");
    System.out.print("请输入会员号:");
    Scanner input = new Scanner(System.in);
    int custno = input.nextInt();
    int index = 0;
    boolean con = false;
    for (int i = 0; i < custNo.length; i++) {//判断会员
        if (custNo[i] == custno) {
            index=i;
            con = true;
        }               
    }
    if (con==false) {
        System.out.println("输入错误");
        System.out.println("请'n'返回上一级菜单:");
        String is = input.next();
        if ("n".equals(is)) {
            showManagement();
        } else {
            while (!"n".equals(is)) {
                System.out.print("输入错误, 请重新'n'返回上一级菜单:");
                is = input.next();
            }
            showManagement();
        }
    }
    System.out.println(" 会员号            生日             积分");
    System.out.println("------------|------------|---------------");
    System.out.println(custNo[index] + "\t" + custBirth[index] + "\t"
            + custScore[index]);
    do{
    System.out.println("**************************************************************");
    System.out.println("           1.修 改 会 员 生 日.");
    System.out.println("           2.修 改 会 员 积 分.");
    System.out.println("**************************************************************");
    System.out.print("请选择,请输入数字:");
    int choos = input.nextInt();
    System.out.println("");
    switch(choos){
    case 1:
        System.out.print("请输入修改后的生日:");
        String custbirth = input.next();
        custBirth[index] = custbirth;
        System.out.println("修改成功");
        break;
    case 2:
        System.out.print("请输入修改后的积分:");
        int custscore = input.nextInt();
        custScore[index] = custscore;
        System.out.println("修改成功");
        break;
    }           
    }while("y".equals(a));
        System.out.print("是否修改其他属性(y/n):");
         a = input.next();
         System.out.println("请'n'返回上一级菜单:");
            String is = input.next();
            if ("n".equals(is)) {
                showManagement();
            } else {
                while (!"n".equals(is)) {
                    System.out.print("输入错误, 请重新'n'返回上一级菜单:");
                    is = input.next();
                }
                managemenu();
            }
}
  • 写回答

1条回答 默认 最新

  • 赫双炏 2017-09-14 05:12
    关注
        case 2:
            System.out.print("请输入修改后的积分:");
            int custscore = input.nextInt();
            custScore[index] = custscore;
            System.out.println("修改成功");
            break;
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制