|
| 1 | +package employee; |
| 2 | + |
| 3 | +import java.util.*; |
| 4 | +class employee |
| 5 | +{ |
| 6 | + int empid; |
| 7 | + long mobile; |
| 8 | +String name, address, mailid; |
| 9 | +Scanner get = new Scanner(System.in); |
| 10 | +void getdata() |
| 11 | +{ |
| 12 | + System.out.print("Enter Name of the Employee:"); |
| 13 | + name = get.nextLine(); |
| 14 | + System.out.print("Enter Mail id:"); |
| 15 | + mailid = get.nextLine(); |
| 16 | + System.out.print("Enter Address:"); |
| 17 | + address = get.nextLine(); |
| 18 | + System.out.print("Enter employee id: "); |
| 19 | + empid = get.nextInt(); |
| 20 | + System.out.print("Enter Mobile Number:"); |
| 21 | + mobile = get.nextLong(); |
| 22 | + } |
| 23 | + void display() |
| 24 | + { |
| 25 | + System.out.println("Employee Name: "+name); |
| 26 | + System.out.println("Employee id : "+empid); |
| 27 | + System.out.println("Mail id : "+mailid); |
| 28 | + System.out.println("Mobile Number: "+mobile); |
| 29 | + } |
| 30 | +} |
| 31 | +class programmer extends employee |
| 32 | +{ |
| 33 | +double salary,bp,da,hra,pf,club,net,gross; |
| 34 | +void getprogrammer() |
| 35 | +{ |
| 36 | +System.out.println("Enter basic pay"); |
| 37 | +bp = get.nextDouble(); |
| 38 | +} |
| 39 | +void calculateprog() |
| 40 | +{ |
| 41 | +da=(0.97*bp); |
| 42 | +hra=(0.10*bp); |
| 43 | +pf=(0.12*bp); |
| 44 | +club=(0.1*bp); |
| 45 | +gross=(bp+da+hra); |
| 46 | +net=(gross-pf-club); |
| 47 | +System.out.println("************************************************"); |
| 48 | +System.out.println("PAY SLIP FOR PROGRAMMER"); |
| 49 | +System.out.println("************************************************"); |
| 50 | +System.out.println("Basic Pay:Rs"+bp); |
| 51 | +System.out.println("DA:Rs"+da); |
| 52 | +System.out.println("PF:Rs"+pf); |
| 53 | +System.out.println("HRA:Rs"+hra); |
| 54 | +System.out.println("CLUB:Rs"+club); |
| 55 | +System.out.println("GROSS PAY:Rs"+gross); |
| 56 | +System.out.println("NET PAY:Rs"+net); |
| 57 | +} |
| 58 | +} |
| 59 | +class asstprofessor extends employee |
| 60 | +{ |
| 61 | +double salary,bp,da,hra,pf,club,net,gross; |
| 62 | +void getasst() |
| 63 | +{ |
| 64 | +System.out.println("Enter basic pay"); |
| 65 | +bp = get.nextDouble(); |
| 66 | +} |
| 67 | +void calculateasst() |
| 68 | +{ |
| 69 | +da=(0.97*bp); |
| 70 | +hra=(0.10*bp); |
| 71 | +pf=(0.12*bp); |
| 72 | +club=(0.1*bp); |
| 73 | +gross=(bp+da+hra); |
| 74 | +net=(gross-pf-club); |
| 75 | +System.out.println("************************************************"); |
| 76 | +System.out.println("PAY SLIP FOR TEAM LEADER "); |
| 77 | +System.out.println("************************************************"); |
| 78 | +System.out.println("Basic Pay:Rs"+bp); |
| 79 | +System.out.println("DA:Rs"+da); |
| 80 | +System.out.println("HRA:Rs"+hra); |
| 81 | +System.out.println("PF:Rs"+pf); |
| 82 | +System.out.println("CLUB:Rs"+club); |
| 83 | +System.out.println("GROSS PAY:Rs"+gross); |
| 84 | +System.out.println("NET PAY:Rs"+net); |
| 85 | + } |
| 86 | +} |
| 87 | +class associateprofessor extends employee |
| 88 | +{ |
| 89 | +double salary,bp,da,hra,pf,club,net,gross; |
| 90 | + void getassociate() |
| 91 | +{ |
| 92 | +System.out.println("Enter basic pay"); |
| 93 | +bp = get.nextDouble(); |
| 94 | +} |
| 95 | +void calculateassociate() |
| 96 | +{ |
| 97 | +da=(0.97*bp); |
| 98 | +hra=(0.10*bp); |
| 99 | +pf=(0.12*bp); |
| 100 | +club=(0.1*bp); |
| 101 | +gross=(bp+da+hra); |
| 102 | +net=(gross-pf-club); |
| 103 | +System.out.println("************************************************"); |
| 104 | +System.out.println("PAY SLIP FOR ASSOCIATE PROFESSOR"); |
| 105 | +System.out.println("************************************************"); |
| 106 | +System.out.println("Basic Pay:Rs"+bp); |
| 107 | +System.out.println("DA:Rs"+da); |
| 108 | +System.out.println("HRA:Rs"+hra); |
| 109 | +System.out.println("PF:Rs"+pf); |
| 110 | +System.out.println("CLUB:Rs"+club); |
| 111 | +System.out.println("GROSS PAY:Rs"+gross); |
| 112 | +System.out.println("NET PAY:Rs"+net); |
| 113 | +} |
| 114 | +} |
| 115 | +class professor extends employee |
| 116 | +{ |
| 117 | +double salary,bp,da,hra,pf,club,net,gross; |
| 118 | +void getprofessor() |
| 119 | +{ |
| 120 | +System.out.println("Enter basic pay"); |
| 121 | +bp = get.nextDouble(); |
| 122 | +} |
| 123 | +void calculateprofessor() |
| 124 | +{ |
| 125 | +da=(0.97*bp); |
| 126 | +hra=(0.10*bp); |
| 127 | +pf=(0.12*bp); |
| 128 | +club=(0.1*bp); |
| 129 | +gross=(bp+da+hra); |
| 130 | +net=(gross-pf-club); |
| 131 | +System.out.println("************************************************"); |
| 132 | +System.out.println("PAY SLIP FOR PROFESSOR"); |
| 133 | +System.out.println("************************************************"); |
| 134 | +System.out.println("Basic Pay:Rs"+bp); |
| 135 | +System.out.println("DA:Rs"+da); |
| 136 | +System.out.println("HRA:Rs"+hra); |
| 137 | +System.out.println("PF:Rs"+pf); |
| 138 | +System.out.println("CLUB:Rs"+club); |
| 139 | +System.out.println("GROSS PAY:Rs"+gross); |
| 140 | +System.out.println("NET PAY:Rs"+net); |
| 141 | +} |
| 142 | +} |
| 143 | +class salary |
| 144 | +{ |
| 145 | +public static void main(String args[]) |
| 146 | +{ |
| 147 | +int choice,cont; |
| 148 | +do |
| 149 | +{ |
| 150 | +System.out.println("PAYROLL"); |
| 151 | +System.out.println(" 1.PROGRAMMER \t 2.TEAM LEADER \t 3.ASSOCIATE PROFESSOR \t 4.PROFESSOR \t 5.EXIT"); |
| 152 | +System.out.print(" ENTER YOUR CHOICE :"); |
| 153 | +Scanner c = new Scanner(System.in); |
| 154 | +choice=c.nextInt(); |
| 155 | +switch(choice) |
| 156 | +{ |
| 157 | +case 1: |
| 158 | +{ |
| 159 | +programmer p=new programmer(); |
| 160 | +p.getdata(); |
| 161 | +p.getprogrammer(); |
| 162 | +p.display(); |
| 163 | +p.calculateprog(); |
| 164 | +break; |
| 165 | +} |
| 166 | +case 2: |
| 167 | +{ |
| 168 | +asstprofessor asst=new asstprofessor(); |
| 169 | +asst.getdata(); |
| 170 | +asst.getasst(); |
| 171 | +asst.display(); |
| 172 | +asst.calculateasst(); |
| 173 | +break; |
| 174 | +} |
| 175 | +case 3: |
| 176 | +{ |
| 177 | +associateprofessor asso=new associateprofessor(); |
| 178 | +asso.getdata(); |
| 179 | +asso.getassociate(); |
| 180 | +asso.display(); |
| 181 | +asso.calculateassociate(); |
| 182 | +break; |
| 183 | +} |
| 184 | +case 4: |
| 185 | +{ |
| 186 | +professor prof=new professor(); |
| 187 | +prof.getdata(); |
| 188 | +prof.getprofessor(); |
| 189 | +prof.display(); |
| 190 | +prof.calculateprofessor(); |
| 191 | +break; |
| 192 | +} |
| 193 | +case 5: |
| 194 | +{System.out.println(" Program is terminated ") ; |
| 195 | +break; |
| 196 | +} |
| 197 | +} |
| 198 | +System.out.println("Press 0 to Quit and 1 to Continue "); |
| 199 | +cont=c.nextInt(); |
| 200 | + |
| 201 | +}while(cont==1); |
| 202 | +} |
| 203 | +} |
| 204 | + |
| 205 | + |
0 commit comments