Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package project0;
- import java.io.DataInputStream;
- import javax.sound.midi.VoiceStatus;
- class Student
- {
- private int rollno;
- private String name;
- DataInputStream dis = new DataInputStream(System.in);
- public void getrollno()
- {
- try
- {
- System.out.print("Enter roll no");
- rollno = Integer.parseInt(dis.readLine());
- System.out.print("Enter name");
- name = dis.readLine();
- }
- catch(Exception) {}
- }
- void putrollno{}
- {
- System.out.print("Roll No ="+rollno);
- System.out.print("Name = "+name);
- }
- }
- class Marks extends Student
- {
- protected int m1,m2,m3;
- void getmarks{}
- {
- try
- {
- System.out.print("Enter marks:");
- m1 = Integer.parseInt(dis.readLine());
- m2 = Integer.parseInt(dis.readLine());
- m3 = Integer.parseInt(dis.readLine());
- }
- catch(Exception e) {}
- }
- void putmarks{}
- {
- System.out.print("m1 = "+m1);
- System.out.print("m2 = "+m2);
- System.out.print("m3 = "+m3);
- }
- }
- class Result extends Marks
- {
- private float total;
- void compute_display()
- {
- total = m1 + m2 + m3;
- System.out.print("Total Marks = "+total);
- }
- }
- class Multilevel
- {
- public static void public static void main(String[] args) {
- Result r = new Result();
- r.getrollno();
- r.getmarks();
- r.putrollno();
- r.putmarks();
- r.compute_display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement