THIS IS A SCHEDULING ALGORITHAM OF TYPE NON-PREEMPTIVE.THAT MEANS THE PROCESS HAVING CALCULATE A EMPLOYEE DETAILS TIME WILL BE PROCESSED NEXT.THIS PROGRAM WILL BE HELP FULL TO STUDY THE
BASIC JAVA.
Java » Language Basics
1: Code :2: /*PROGARM FOR CREATE A EMPLOYEE DETAILS*/
3: 4: 5: import java.lang.*; 6: import java.io.*;7: class Employee
8: {9: int empno;
10: String name; 11: Employee() 12: {13: try
14: {15: DataInputStream d=new DataInputStream(System.in);
16: System.out.println("name of the employee
17: "); 18: name=d.readLine();19: System.out.println("Employy no:");
20: empno=Integer.parseInt(d.readLine()); 21: }22: catch(IOException e)
23: {24: System.out.println("ioerror");
25: } 26: }27: void Display()
28: { 29: } 30: } 31: 32: class manager extends Employee
33: { 34: String desig;35: int bp;
36: int hra;
37: int ta=100,da,inc;
38: manager() 39: {40: try
41: {42: DataInputStream d=new DataInputStream(System.in);
43: System.out.println("salary is
44: "); 45: bp=Integer.parseInt(d.readLine());46: System.out.println("desig of the employee
47: "); 48: desig=d.readLine(); 49: hra=(bp*10)/100; 50: da=(bp*5)/100; 51: inc=(bp*15)/100; 52: }53: catch(IOException e1)
54: { 55: 56: System.out.println("error");
57: } 58: }59: void Display()
60: { 61: 62: 63: System.out.println(name+" "+empno+" "+desig+" "+" "+(bp+hra+da+ta+inc)
64: ); 65: 66: } 67: }68: class Typist extends Employee
69: { 70: 71: int bp;
72: String desig;73: int hra;
74: int ta=0,da,inc;
75: Typist() 76: {77: try
78: {79: DataInputStream d=new
80: DataInputStream(System.in);
81: System.out.println("salary is
82: "); 83: bp=Integer.parseInt(d.readLine());84: System.out.println("desig of the employee
85: "); 86: desig=d.readLine(); 87: hra=(bp*8)/100; 88: da=(bp*4)/100; 89: inc=(bp*10)/100; 90: }91: catch(IOException e1)
92: {93: System.out.println("error");
94: } 95: }96: void Display()
97: { 98: 99: System.out.println(name+" "+empno+" "+desig+" "+" "+(bp+hra+da+ta+inc)
100: ); 101: 102: } 103: } 104: 105: public class lab1
106: {107: public static void main(String args[]) throws IOException
108: {109: manager m=new manager();
110: Typist t=new Typist();
111: System.out.println(" EMPLOYEE DETAILS" );
112: System.out.println(" ~~~~~~~~~~~~~~~~" );
113: System.out.println("Name Code Designation
114: Salary ");115: System.out.println("~~~~ ~~~~ ~~~~~~~~~~~
116: ~~~~~~ "); 117: m.Display(); 118: t.Display(); 119: 120: } 121: }Source : Google
No comments:
Post a Comment
please write your mail id for contact: