Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

package javproject;

import java.util.*;
abstract class doctor
{
Scanner sc =new Scanner(System.in);
int ph_no;
int doc_no;
String qualification;
String d_name;
public void getinfo()
{
System.out.println("enter the phone no. of doctor");
ph_no=sc.nextInt();
System.out.println("enter the doctor no. of doctor");
doc_no=sc.nextInt();
System.out.println("enter the qualification of doctor");
qualification=sc.next();
System.out.println("enter the name of doctor");
d_name=sc.next();
}
public void showinfo()
{
System.out.println("phone no. of doctor: "+ph_no);
System.out.println("Doctor no. of doctor "+doc_no);
System.out.println("Qualification of doctor"+qualification);
System.out.println("Name of the doctor"+d_name);
}
}

class regular_doc extends doctor


{
Scanner s=new Scanner(System.in);
int salary;
void getregularinfo()
{
getinfo();
System.out.println("enter the salary of doctor");
salary=s.nextInt();
}
void showregularinfo()
{
showinfo();
System.out.println("Salary of the doctor: "+salary);
}
}
class doc_oncall extends doctor
{
Scanner sc=new Scanner(System.in);
int fs_p_cl;
void getoncallinfo()
{
getinfo();
System.out.println("enter the fees per call of doctor");
fs_p_cl=sc.nextInt();
}
void showoncallinfo()
{
showinfo();
System.out.println("fees per call of doctor: "+fs_p_cl);
}
}

public class hospital{

public static void main(String []args)


{

You might also like