标签:
package com;
import java.util.Scanner;
public class hehe {
Scanner input = new Scanner(System.in);
String name[] = new String[10];
int age[] = new int[10];
int jifen[] = new int[10];
int xiaoyu;
int dayu;
String jixv;
int a;
String b;
String quer;
int mima1;
int mima;
int mima2;
int mima3;
int mima4;
String naem1;
String name1;
public void main() {
System.out.println("系统登陆" +
"\n1.登 陆 功 能" +
"\n2.注册" +
"\n3.修改管理员密码" +
"\n4.退出\n****************************************************************************" +
"\n请选择输入:");
int a = input.nextInt();
switch (a) {
case 1:
dl();
break;
case 2:
zhuce1();
break;
case 3:
xiugai();
break;
case 4:
System.out.println("谢谢您的使用!");
break;
}
}
public void dl(){
if(naem1!=null){
System.out.println("请输入账号:");
name1=input.next();
System.out.println("请输入密码:");
mima3=input.nextInt();
while(!name1.equals(naem1)|| mima3!=mima1){
System.out.println("输入错误!无法登陆!!");
System.out.println("请再次输入!");
System.out.println("请输入账号:");
name1=input.next();
System.out.println("请输入密码:");
mima3=input.nextInt();
}
System.out.println("登陆成功!!" +
"\n****************************************************************************");
dd();}else{
System.out.println("没有注册,请先注册!!!"+
"\n****************************************************************************");
main();
}
}
public void dd() {
System.out.println("1.显示所有会员信息" +
"\n2.统计会员年龄层次" +
"\n3.添加会员信息"+
"\n4.查寻会员积分" +
"\n5.系统积分年度升级" +
"\n6.退出\n****************************************************************************" +
"\n请选择输入:");
int b = input.nextInt();
switch (b) {
case 1:
cc();
break;
case 2:
b();
break;
case 3:
c();
break;
case 4:
d();
break;
case 5:
System.out.println("年度积分升级!");
break;
case 6:
main();
break;
default:
System.out.println("输入错误,重新输入" +
"\n*****************************************");
dd();
break;
}
}
public void cc() {
for (int i = 0; i < name.length; i++) {
if (null == (name[0])) {
System.out.println("没有会员信息,请添加后再来查询");
dd();
} else {
if (null != (name[i])) {
System.out.println(name[i] + "\t" + age[i] + "\t"
+ jifen[i]);
} else {
dd();
}
}
}
}
public void b() {
for (int i = 0; i < age.length; i++) {
if (age[0] == 0) {
System.out.println("请先添加");
dd();
} else {
if (age[i] == 0) {
break;
} else {
if (20 < age[i]) {
xiaoyu = xiaoyu + 1;
} else {
dayu = dayu + 1;
}
}
}
}
System.out.println("20岁以下的有" + xiaoyu);
System.out.println("20岁及以上的有" + dayu);
dd();
}
public void c() {
System.out.println("添加会员信息");
for (int i = 0; i < name.length; i++) {
if (name[i] == null) {
System.out.println("输入名字");
name[i] = input.next();
System.out.println("年龄");
age[i] = input.nextInt();
System.out.println("积分");
jifen[i] = input.nextInt();
System.out.println("是否继续:(y/n)");
jixv = input.next();
if ("y".equals(jixv)) {
continue;
} else {
dd();
}
}
}
}
public void d() {
for (int i = 0; i < age.length; i++) {
if (age[0] == 0) {
System.out.println("请先添加");
dd();
} else{
System.out.println("输入会员名字");
b = input.next();
for (int j = 0; i < name.length; i++) {
if (b.equals(name[j])) {
System.out.println("积分为:" + jifen[j]);
}
}}
dd();
}
}
public void xiugai(){
if(naem1!=null){
System.out.println("修改管理员");
System.out.println("请输入原密码");
mima2=input.nextInt();
System.out.println("再次确认密码");
mima=input.nextInt();
if(mima==mima1){
System.out.println("请输入新密码:");
mima4=input.nextInt();
mima1=mima4;
System.out.println("密码修改成功!");
main();
}else{
System.out.println("密码输入错误!!!!" +
"\n****************************");
main();
}
}else{
System.out.println("无法修改!");
main();
}
}
public void zhuce1(){
if(naem1!=null){
System.out.println("您已经注册!");
main();
}else{
System.out.println("输入用户名");
naem1=input.next();
System.out.println("输入密码");
mima1=input.nextInt();
System.out.println("是否确认密码(y/n)");
quer=input.next();
if("y".equals(quer)){
System.out.println("注册成功");
main();
}else{
while(!"y".equals(quer)){
System.out.println("输入用户名");
naem1=input.next();
System.out.println("输入密码");
mima1=input.nextInt();
System.out.println("是否确认密码(y/n)");
quer=input.next();
}
System.out.println("注册成功");
main();
}
}
}
}
package com;
public class aa {
public static void main(String[] args) {
hehe kk=new hehe();
kk.main();
}
}
标签:
原文地址:http://www.cnblogs.com/dqn-1996-02/p/5105882.html