-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRetrospection.java
More file actions
63 lines (57 loc) · 2.42 KB
/
Retrospection.java
File metadata and controls
63 lines (57 loc) · 2.42 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package start;
import java.util.Scanner;
public class Retrospection {
public static void main(String[] args) {
byte age = 18;
double salary = 500.99;
char sign = 'T';
boolean flag = true;
System.out.println(sign + 1);
System.out.println((char)(sign + 1));
System.out.printf("%d | %.2f | %c | %s \n", age, salary, sign, flag);
System.out.println("Hello World!");
// () ? () : ()
Scanner scanner = new Scanner(System.in);
// System.out.println("Podaj rok urodzenia");
// int age_scanner = scanner.nextInt();
// String decision = (2019 - age_scanner) >= 18 ? "pełnoletnia" : "małolat";
// System.out.println(decision);
// System.out.println("Podaj staż pracy");
// scanner.useLocale(Locale.US);
// double staz = scanner.nextDouble();
// scanner.nextLine();
// System.out.println("Podaj imię");
// String name = scanner.nextLine();
//
// System.out.println("Twój staż: " + staz);
// System.out.println("Twój imię: " + name);
System.out.println("Podaj rok urodzenia");
int year = scanner.nextInt();
scanner.nextLine();
// -IF1-----------------------------------------------------------
if(year < 0 || year > 2019 ){
System.out.println("Błędne dane!");
} else {
// -IF2--------------------------------------------------------
if ((2019 - year) >= 18) {
System.out.println("Logowanie: podaj login i hasło!");
String login = scanner.nextLine();
String password = scanner.nextLine();
// -IF3--------------------------------------------------
if(login.equals("admin") && password.equals("admin")){
System.out.println("Witaj adminie");
} else if (login.equals("user") && password.equals("user")){
System.out.println("Witaj userze");
} else {
System.out.println("Błąd logowania!");
}
// -----------------------------------------------------
} else {
System.out.println("Niepełnoletni");
}
// ----------------------------------------------------------
}
// ---------------------------------------------------------
scanner.close();
}
}