-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculatorSystem.java
60 lines (47 loc) · 1.44 KB
/
CalculatorSystem.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
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
package WEEK6;
import java.util.Scanner;
public class CalculatorSystem {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter your name: ");
String name = s.next.line( );
String username = "[email protected]";
System.out.println("Enter your password");
int password =s.nextInt();
char gender= 'M';
if (username =="[email protected]" && password == 1234 || gender == 'F') {
System.out.println("login was succeeded");
System.out.println("welcome "+ name);
System.out.println("Enter a number ");
int number1 =s.nextInt();
System.out.println("Enter another number ");
int number2 = s.nextInt();
System.out.println("press 1 for +");
System.out.println("press 2 for -");
System.out.println("press 3 for *");
System.out.println("press 4 for /");
int operator = s.nextInt()
;
if (operator == 1) // +
System.out.println(number1+number2);
else if(operator == 2)// -
System.out.println(number1 - number2);
else if (operator == 3) // *
System.out.println(number1 * number2);
else if (operator == 4) // / {
if (number2 ! == 0 )
System.out.println("Invalid diviser");
else
System.out.println( number1 / number2);
// == checks if two things are equal .
// != = ! + = if two things are not equal .
else
System.out.println("Invalid input");
}
else
{
System.out.println("invalid info");
}
System.out.println(5 == 5);
}
}