-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarks.java
32 lines (32 loc) · 808 Bytes
/
Marks.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
package Inheritance;
class Marks extends Student{
int AdmNo;
int marks;
String sub;
Marks(String n, int a, String b, int ad, int m, String s){
super(n,a,b);
AdmNo=ad;
marks=m;
sub=s;
}
char grade(){
if(marks>=80)
return 'A';
else if(marks<80 && marks>=50)
return 'B';
else
return 'C';
}
void display(){
super.display();
System.out.println("Admission Number: "+AdmNo);
System.out.println("Marks: "+marks);
System.out.println("Subject: "+sub);
System.out.println("Grade Obtained: "+grade());
}
public static void main(String args[]){
Marks ob= new Marks("Rishi",18,"+B",44684,95,"Chemistry");
ob.grade();
ob.display();
}
}