program to print employee details using multilevel inheritance
in this program used multi level inheritance, method and switch statement.
//program to print employee details using multilevel inheritance
output:
//program to print employee details using multilevel inheritance
package management;
import java.util.Scanner;
class teacher{
void tech(){
System.out.println("!!!Subject!!!\t\t!!Empid!!\n1)java\t\t\t101\n2)php\t\t\t102\n3)Android\t\t103\n\n");
}
}
class Admin extends teacher{
void admin(){
System.out.println("!!!Salary!!!\t\t!!Shift!!\n1)rs25,000\t\t9:00
AM to 5:00PM\n2)rs30,000\t\t9:00 AM to 5:30PM)\n3)rs45,000\t\t5:00 PM to 9:00AM\n\n");
}
}
class Manage extends Admin{
void manager(){
System.out.println("!!!HR Salary!!!\t\t!!!FinanceSalary!!!\n
1)Rs35,000\t\t40,000\n2)Rs45,000\t\t47,000\n1)Rs55,000\t\t57,000\n");
}
}
public class Management {
public static void
main(String[] args) {
// TODO code
application logic here
Manage m=new
Manage();
Scanner s=new
Scanner(System.in);
System.out.println("Enter your Department\n
1.teacher\n2.admin\n3.manager\n");
String
dept=s.nextLine();
if(dept.equals("teacher"))
{ m.tech();
}
else
if(dept.equals("admin"))
{ m.admin();
}
else
if(dept.equals("manager"))
{ m.manager();
}
else
{
System.out.println("Invalid Input again try");
}
}
}
output:
0 comments: