-
Notifications
You must be signed in to change notification settings - Fork 0
/
looping3.java
32 lines (24 loc) · 982 Bytes
/
looping3.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import hsa.*;
public class looping3{
public static void main(String[] args){
Console con = new Console();
String strPassword;
int intAttempts;
intAttempts = 0;
strPassword = "";
con.println("Welcome to the FiftyCent Computer System");
con.println("suthorization is required");
while(!strPassword.equals("twoquarters") && intAttempts < 3){
// ! means NOT. in this case. The password should not equal "twoquarters")
//if you want to use not when comparing numbers, use !=
con.println("What is the password");
strPassword = con.readLine();
intAttempts = intAttempts + 1;
}
if(strPassword.equals("twoquarters")){
con.println("welcome to the system... have some beats headphones");
}else{
con.println("ERROR.. TOO MANY INCORRECT TRIES!");
}
}
}