您的位置:首页 > 编程语言

用户信息录入系统代码分享(调试了…

2015-04-19 22:57 169 查看
package com;

import java.util.Scanner;

public class Demo5 {

public static void main(String[] args) {

System.out.println("请输入您要录入用户的数量:");

Scanner input=new Scanner(System.in);

int num=input.nextInt();//接受用户数量

int userNum=0000;

boolean a=true;

boolean b=true;

int i=1;//用于记录用户数

int old=0;

int jifen=0;

while(i<=num){

do{

while(a){

System.out.println("请输入第"+i+"用户编号<4位数>:");

userNum=input.nextInt();

if(userNum>9999||userNum<</span>999){

b=true;

}else{

b=false;

}

while(b){

System.out.println("输入错误,请重新输入用户编号:");

userNum=input.nextInt();

if(userNum>9999||userNum<</span>999){

b=true;

}else{

b=false;

}

}

a=false;

}

a=true;

while(a){

System.out.println("请输入用户年龄:");

old=input.nextInt();

if(old<</span>10){

System.out.println("您的年龄小于10周岁,录入失败");

a=false;

i--;

}

a=false;

}

a=true;

if(old<</span>10){ a=false;}

while(a){

System.out.println("输入用户积分:");

jifen=input.nextInt();

a=false;

}

a=true;

if(old<</span>10){ a=false;}

while(a){

System.out.println("------------------------------------------");

System.out.println("|"+"用户编号:"+userNum+"\t"+"用户年龄:"+old+"\t"+"用户积分:"+jifen+"|");

System.out.println("------------------------------------------");

a=false;

}

}while(a);

i++;

a=true;

}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: