-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path4.java
More file actions
46 lines (45 loc) · 954 Bytes
/
4.java
File metadata and controls
46 lines (45 loc) · 954 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
import java.util.*;
class Sports{
float score;
public void putScore(float b)
{
score=b;
}
}
class Marks extends Sports
{
float marks;
public void putMarks(float b)
{
marks=b;
}
}
class Student extends Marks
{
int rollno;
public void putNo(int b)
{
rollno=b;
}
}
public class Main{
public static void main(String[] args)
{
int j;
Scanner sc = new Scanner (System.in);
//System.out.println("Enter the number of students");
//int i = sc.nextInt();
Student ob =new Student();
System.out.print("Enter the rollno of student :");
int rn = sc.nextInt();
System.out.print("Enter the marks of student :");
float m = sc.nextFloat();
System.out.print("Enter the Score of student :");
float s = sc.nextInt();
ob.putScore(s);
ob.putMarks(m);
ob.putNo(rn);
System.out.println("ROLL NO\tMARKS\tSCORE");
System.out.println(ob.rollno+"\t"+ob.marks+"\t"+ob.score);
}
}