1个回答
展开全部
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Scanner;
public class TestRandom {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = 0;
int b = 0;
System.out.println("即将上班,请签到...");
System.out.println("请假或签到...");
while (true) {
String line = s.next();
if("签到".equals(line.trim())){
a++;
System.out.println("有" + a +"员工签到");
}else if("请假".equals(line.trim())){
b++;
System.out.println("有" + b +"员工请假");
}else{
System.out.println("输入有误,请重新输入");
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Scanner;
public class TestRandom {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = 0;
int b = 0;
System.out.println("即将上班,请签到...");
System.out.println("请假或签到...");
while (true) {
String line = s.next();
if("签到".equals(line.trim())){
a++;
System.out.println("有" + a +"员工签到");
}else if("请假".equals(line.trim())){
b++;
System.out.println("有" + b +"员工请假");
}else{
System.out.println("输入有误,请重新输入");
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询