Untitled
unknown
plain_text
2 years ago
1.5 kB
10
Indexable
import java.util.Scanner;
class employee
{
String name;
String address;
int age;
int phone;
int salary;
public void display()
{
Scanner sobj=new Scanner(System.in);
System.out.println("enter the name:");
name=sobj.next();
System.out.println("enter the address:");
address=sobj.next();
System.out.println("enter the age:");
age=sobj.nextInt();
System.out.println("enter the salary:");
salary=sobj.nextInt();
System.out.println("enter the phone no:");
phone=sobj.nextInt();
}
public void Print_salary()
{
System.out.println("the salary is "+salary);
}
}
class officers extends employee
{
String specilisations;
String department;
public void specs()
{
Scanner sobj=new Scanner(System.in);
System.out.println("enter the specilisations:");
specilisations=sobj.nextLine();
System.out.println("enter the department:");
department=sobj.next();
}
public void display2()
{
System.out.println("the specilisations is"+specilisations);
}
}
class manager extends employee
{
String department;
public void display3()
{
System.out.println("the department is ",+department);
System.out.println("the specilisations is"+specilisations);
}
}
public class emp
{
public static void main(String S[])
{
officers o=new officers();
o.display();
o.Print_salary();
o.specs();
o.display2();
manager m=new manager();
m.dept();
m.display3();
}
}
Editor is loading...
Leave a Comment