Iam_Sandeep

Untitled

Dec 10th, 2021
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. import java.util.*;
  2. class Faculty{
  3.     int empid;
  4.     String name;
  5.     String school;
  6.     Faculty(int a,String b,String c){
  7.         this.empid=a;
  8.         name=b;
  9.         school=c;
  10.     }
  11. }
  12. class GuestLecture extends Faculty{
  13.     String title;
  14.     String resource;
  15.     String venue;
  16.     int duration;
  17.     String date;
  18.     GuestLecture(String a,String b,String c,String d,int e,String f){
  19.         super(0,d,"unknown");
  20.         title=a;
  21.         resource=b;
  22.         venue=c;
  23.         duration =e;
  24.         date=f;
  25.     }
  26.     void display(){
  27.         System.out.println("name:"+this.name);
  28.         System.out.println("id:"+this.empid);
  29.         System.out.println("resource:"+this.resource);
  30.         System.out.println("venue:"+this.venue);
  31.         System.out.println("duration:"+this.duration);
  32.         System.out.println("Date:"+this.date);
  33.    
  34. }
  35. }
  36.     public class MyClass
  37.     {  
  38.         static void show(GuestLecture []x,int n){
  39.             for(int i=0;i<n;++i){
  40.                 System.out.println("Guest LEcture "+ i+1);
  41.                  x[i].display();
  42.                  System.out.println("******");
  43.             }
  44.            
  45.         }
  46.         public static void main(String[] args)  {  
  47.             GuestLecture t1=new GuestLecture("hey","hello","atl","ramesh",100,"08092001");
  48.             GuestLecture t2=new GuestLecture("hey","hello","atl","suresh",100,"08092001");
  49.             GuestLecture t[]=new GuestLecture[2];
  50.             t[0]=t1;
  51.             t[1]=t2;
  52.             show(t,2);
  53.         }  
  54.      
  55.      
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment