-
-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathconditionals_practice.java
More file actions
88 lines (88 loc) · 2.32 KB
/
conditionals_practice.java
File metadata and controls
88 lines (88 loc) · 2.32 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import java.util.Scanner;
public class conditionals_practice {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int sub_1 = sc.nextInt();
int sub_2 = sc.nextInt();
int sub_3 = sc.nextInt();
int avg = (sub_1+sub_2+sub_3)/3;
if((avg>=40)&&(sub_1>=33)&&(sub_2>=33)&&(sub_3>=33))
{
System.out.println("STUDENT IS PASSED");
}
else
{
System.out.println("STUDENT IS FAILED");
}
long salary = sc.nextLong();
if(salary<=250000)
{
System.out.println("NO TAX");
}
else if ((salary>250000)&&(salary<500000))
{
System.out.println("TAX IS "+5*salary/100);
}
else if((salary>500000)&&(salary<1000000))
{
System.out.println("TAX IS "+20*salary/100);
}
else
{
System.out.println("TAX IS "+30*salary/100);
}
int num = sc.nextInt();
switch (num)
{
case 1:
System.out.println("MONDAY");
break;
case 2:
System.out.println("TUESDAY");
break;
case 3:
System.out.println("WEDNESDAY");
break;
case 4:
System.out.println("THURSDAY");
break;
case 5:
System.out.println("FRIDAY");
break;
case 6:
System.out.println("SATURDAY");
break;
case 7:
System.out.println("SUNDAY");
break;
default:
System.out.println("FUNDAY");
}
long year = sc.nextLong();
if(year%400==0)
{
System.out.println("LEAP YEAR");
}
else
{
System.out.println("NOT A LEAP YEAR");
}
String s = sc.nextLine();
if(s.endsWith(".org"))
{
System.out.println("Organization website");
}
else if(s.endsWith(".com"))
{
System.out.println("Commercial website");
}
else if(s.endsWith(".in"))
{
System.out.println("Indian website");
}
else
{
System.out.println("Invalid Domain");
}
}
}