Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Eliminate the setAkkum(), setCount(), getCount(), getAkkum() and getAvg() from the Employee class and use the equivalent methods from the Average class / This constructor initializes
Eliminate the setAkkum(), setCount(), getCount(), getAkkum() and getAvg() from the Employee class and use the equivalent methods from the Average class
/ This constructor initializes the name, idNum department, Count, position, salary and akkum fields. @param n The employee's name. @param id The employee's ID number. @param dept The employee's department. @param ct The employee count. @param pos The employee's position. @ param salry The employee's earnings. (@) param ak The employee's earnings. */ public Employee(String n, String id, String dept, int ct, String pos, double salry, double ak) f name =n; idNumber = Integer. parselnt(id); department = dept; Count =ct; position = pos; salary = salry; akkum=ak; gotEmps = true; \} / The setName method accepts an argument which is stored in the name field. @ param n The employee's name. */ public void setName(String n) 1 name =n; ) /** The setldNumber method accepts an argument which is stored in the idNumber field. @param num The employee's ID number. */ public void setIdNumber(String num) \{ id Number = Integer.parselnt(num); \} / The setDepartment method accepts a parameter which is stored in the department field. @param d The employee's department. */ public void setDepartment(String d) \} department =d; \} /** setCount, counts the number of salaries */ public void setCount() 1 Count++; \} / The setPosition method accepts an argument which is stored in the position field @param p The employee's position. */ public void setPosition(String p) \& position =p; \} / This constructor initializes the name, idNum department, Count, position, salary and akkum fields. @param n The employee's name. @param id The employee's ID number. @param dept The employee's department. @param ct The employee count. @param pos The employee's position. @ param salry The employee's earnings. (@) param ak The employee's earnings. */ public Employee(String n, String id, String dept, int ct, String pos, double salry, double ak) f name =n; idNumber = Integer. parselnt(id); department = dept; Count =ct; position = pos; salary = salry; akkum=ak; gotEmps = true; \} / The setName method accepts an argument which is stored in the name field. @ param n The employee's name. */ public void setName(String n) 1 name =n; ) /** The setldNumber method accepts an argument which is stored in the idNumber field. @param num The employee's ID number. */ public void setIdNumber(String num) \{ id Number = Integer.parselnt(num); \} / The setDepartment method accepts a parameter which is stored in the department field. @param d The employee's department. */ public void setDepartment(String d) \} department =d; \} /** setCount, counts the number of salaries */ public void setCount() 1 Count++; \} / The setPosition method accepts an argument which is stored in the position field @param p The employee's position. */ public void setPosition(String p) \& position =p; \} import java.util.Scanner; import java.io.*; public class EmployeeDemoClass \{ public static void main(String[] args) throws IOException l PrintWriter toOutFile; Employee worker = new Employee(); int employeeNumber =0; String input, emplnfo = "', String filename = "" ; File dFile; Scanner readFile; filename = getFileName(worker.getBull()); dFile = new File(filename); if (dFile.exists()) \{ System.out.println(" The file " + filename + " already exists. Bye!!!"); System.exit(0); \} toOutFile = new PrintWriter(dFile); employeeNumber = getinput(); for (int count =0; countStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started