You are on page 1of 3

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package javaapplication12;

import java.util.Scanner;

/**

* @author Ifeoma

*/

class employeee

int id;

String name;

Scanner input = new Scanner(System.in);

employeee()

System.out.println("Enter Id of the Employee:");

id = input.nextInt();

System.out.println("Enter Name of the Employee:");

name = input.next();

void display()

System.out.println("Employee Id: "+ id);


System.out.println("Name: "+ name);

class employeeSalary extends employeee

float salary;

double allowance, net;

employeeSalary()

System.out.println("Enter Salary:");

salary = input.nextFloat();

void calculatesalary()

allowance = salary * 0.05;

net = salary - allowance;

void result()

System.out.println("Employee Details\n");

super.display();

System.out.println("Salary: £"+ salary);

System.out.println("Net Salary: £"+ net);

public class JavaApplication12 {


/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic he

for(int i=0;i<2;i++)

System.out.println("Employee Details: ");

employeeSalary Emp = new employeeSalary();

Emp.display();

Emp.calculatesalary();

Emp.result();

You might also like