forked from Ashish8104/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportCard.java
More file actions
52 lines (49 loc) · 806 Bytes
/
ReportCard.java
File metadata and controls
52 lines (49 loc) · 806 Bytes
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
interface Exam
{
void per_cal();
}
class Student
{
String Name;
int r,marks1,marks2;
Student(String name,int roll,int m1,int m2)
{
Name=name;
r=roll;
marks1=m1;
marks2=m2;
}
void Display()
{
System.out.println("Name :"+Name);
System.out.println("Roll No. :"+r);
System.out.println("Marks in two Subject - In First:"+marks1+"\nIn Second"+marks2);
}
}
class Result extends Student implements Exam
{
float percent;
Result(String n,int r,int m1,int m2)
{
super(n,r,m1,m2);
}
public void per_cal()
{
int total = marks1+marks2;
percent = (float)total/2;
}
void Show()
{
Display();
System.out.println("Percentage is :"+percent);
}
}
class ReportCard
{
public static void main(String s[])
{
Result r = new Result("Ashish",16,80,82);
r.per_cal();
r.Show();
}
}