GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/Programs/eduInstitute.java at main · arshcoder13/Java Expand file tree/ Copy patheduInstitute.javaMore file actions 66 lines (62 loc) · 1.6 KB / Copy patheduInstitute.javaFile metadata and controls66 lines (62 loc) · 1.6 KB 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 package realWorldScenario; import java.util.Scanner; class Person { Scanner sc = new Scanner(System.in); public String name; public int id; } class Student extends Person { public int year; public String course; void getDetails() { System.out.println("Enter name: "); name = sc.nextLine(); System.out.println("Enter id: "); id = sc.nextInt(); System.out.println("Enter year: "); year = sc.nextInt(); System.out.println("Enter course: "); course = sc.next(); System.out.println(); } void display() { System.out.println("Displaying student details: "); System.out.println("Name: " + name); System.out.println("ID: " + id); System.out.println("Year: " + year); System.out.println("Course: " + course); } } class Teacher extends Person { public int expYears; public String subject; void getDetails() { System.out.println("Enter name: "); name = sc.nextLine(); System.out.println("Enter id: "); id = sc.nextInt(); System.out.println("Enter years of experience: "); expYears = sc.nextInt(); System.out.println("Enter subject: "); subject = sc.next(); } void display() { System.out.println("Displaying teacher details: "); System.out.println("Name: " + name); System.out.println("ID: " + id); System.out.println("Years of experience: " + expYears); System.out.println("Subject taught: " + subject); } } public class EduInstitute { public static void main(String[] args) { // TODO Auto-generated method stub Student s1 = new Student(); s1.getDetails(); s1.display(); System.out.println(); Teacher t1 = new Teacher(); t1.getDetails(); t1.display(); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |