-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path7.2 Attendance Calculator.java
77 lines (60 loc) · 1.55 KB
/
7.2 Attendance Calculator.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
A student will not be allowed to sit in exam if his/her attendence is less than 75%. Take following input from user
Number of classes held
Number of classes attended.
And print
percentage of class attended
Is student is allowed to sit in exam or not.
Input Format
Number of classes held
Number of classes attended.
Constraints
Number of classes held >= Number of classes attended.
and both must be Positive integer
Output Format
percentage of class attended
Is student is allowed to sit in exam or not.
Sample Input 0
100
80
Sample Output 0
80
Yes
Explanation 0
Number of classes held : 100
Number of classes attended : 80
And Output
percentage of class attended : 80
Is student is allowed to sit in exam or not : Yes
Sample Input 1
50
34
Sample Output 1
68
No
Explanation 1
Number of classes held : 50
Number of classes attended : 34
And Output
percentage of class attended : 68
Is student is allowed to sit in exam or not : No
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
//class held as ch;
double ch = sc.nextDouble();
//class attended as ca;
double ca = sc.nextDouble();
//percentage of attendence
double per = (ca*100/ch);
System.out.println((int)per);
if((int)per <75)
System.out.print("No");
else
System.out.print("Yes");
}
}