// // Technician.java // import java.util.Scanner; public class Technician extends Employee { private int level; public Technician() { super(); level = 0; } public Technician(String n, double s, int l) { super(n, s); level = l; } public void reset(String n, double s, int l) { reset(n, s); level = l; } public double getLevel() { return level; } public void setLevel(int l) { level = l; } public String toString() { return "Name: " + getName() + "\n" + "Service year: " + getServiceYear() + "\n" + "Salary: " + salary(); } public double salary() { return 30000 + 2000 * getServiceYear() + 1000 * level; } //----------------- driver code follows public static void display(Person one) { System.out.println(one); } public static void main(String[] args) { Scanner kb = new Scanner(System.in); Person first = new Person("Jame Smith"); Employee second = new Employee("April Bush", 2); Technician third = new Technician(); boolean go = true; while(go) { System.out.print("Person name: "); String name = kb.nextLine(); first.setName(name); System.out.print("Employee name: "); name = kb.nextLine(); System.out.print("Service year: "); double year = kb.nextDouble(); String dummy = kb.nextLine(); // consume "\n" + spaces second.reset(name, year); System.out.print("Tech. name: "); name = kb.nextLine(); System.out.print("Service year: "); year = kb.nextDouble(); System.out.print("Level: "); int level = kb.nextInt(); third.reset(name, year, level); display(first); display(second); display(third); System.out.print("Go on (y/n): "); String answer = kb.next(); if(answer.equalsIgnoreCase("n")) go = false; dummy = kb.nextLine(); } } }