-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcondition.java
More file actions
52 lines (43 loc) · 1.37 KB
/
Copy pathcondition.java
File metadata and controls
52 lines (43 loc) · 1.37 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
import java.util.*;
public class condition {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// System.out.print("enter your age : ");
// int age = sc.nextInt();
// if (age >=18) {
// System.out.println("you are Adult");
// } else {
// System.out.println("you are child");
// }
// sc.close();
// // Print largest number
// int a = 10;
// int b = 3;
// if (a>b) {
// System.out.println("A is greater than B");
// } else {
// System.out.println("b is less than A");
// }
// // Income Tax Calculaor
Scanner sc = new Scanner(System.in);
System.out.print("enter your income : ");
int income = sc.nextInt();
int tax;
if (income < 500000) {
tax = 0;
} else if (income >= 500000 && income < 1000000){
tax = (int) (income * 0.02);
} else {
tax = (int) (income * 0.03);
}
System.out.println("your tax is " + tax);
sc.close();
// Tenary operator
int number = 4;
String type = ((number%2)==0)?"even":"odd";
System.out.println(type);
int marks = 67;
String status = marks>=33 ? "PASS" : "FAIL";
System.out.println(status);
}
}