-
Notifications
You must be signed in to change notification settings - Fork 0
/
YT34.java
86 lines (70 loc) · 1.69 KB
/
YT34.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
78
79
80
81
82
83
84
85
86
import java.io.*;
public class YT34
{
String name;
int rno, per;
double sch, tSch;
double stripend;
public YT34()
{
name="";
rno=0;
per=0;
sch=0;
stripend=0;
tSch=0;
}
public void enter(String n, int r, int p)
{
name=n;
rno=r;
per=p;
}
public void compute()
{
if(per>=90)
{
stripend=5000;
sch=(double)10/100*stripend;
}
else if(per>=70 && per<90)
{
stripend=4000;
sch=(double)8/100*stripend;
}
else if(per>=60 && per<70)
{
stripend=3500;
sch=(double)5/100*stripend;
}
else
{
stripend=2500;
sch=0;
}
tSch=stripend+sch;
}
public void print()
{
System.out.println("Name: "+name);
System.out.println("Roll Number: "+rno);
System.out.println("Total Sch: "+tSch);
}
public static void main(String[] args)throws IOException
{
String n1;
int r1, p1;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the name:");
n1=br.readLine();
System.out.println("Enter the roll number:");
r1=Integer.parseInt(br.readLine());
System.out.println("Enter the percent:");
p1=Integer.parseInt(br.readLine());
YT34 S1 = new YT34();
S1.enter(n1, r1, p1);
S1.compute();
S1.print();
}
}