Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PROGRAM MUST USE GENERIC, AND WRAPPER CLASS. NO PRIMITIVE DATA TYPES. Define a J

ID: 3707317 • Letter: P

Question

PROGRAM MUST USE GENERIC, AND WRAPPER CLASS. NO PRIMITIVE DATA TYPES.
Define a Java class called Employee. The class has data members and accompanying accessor and mutator methods for each of the following six data items. (This involves creating the file Employee.java.)
* id (string) * name (string) * salary (double) * department (string) * position (string) * years of service (integer) 2. Create a text (data) file containing data for at least five different employees (objects). Let each data item sit on its own line in the text file. For example, the first six lines of the file might look like: 086244 Sally L. Smith 100000.00 Accounting Manager 7 3. ‘Heap’ is a tree-based data-structure that satisfies the heap property. A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the children of that node. By having a heap (or an array that satisfies the heap property), it would be more efficient (generally faster) to perform important tasks on the array such as finding the maximum element in the array (and removing it) and sorting the array. In this assignment, you will have to write a program that reads a list of employees from a file. The name of the file will be ‘Employee.txt’. The program should output the *sorted* array to a file called “SortedEmployee.txt” You MUST include Employee.txt in your project submission. PROGRAM MUST USE GENERIC, AND WRAPPER CLASS. NO PRIMITIVE DATA TYPES.
Define a Java class called Employee. The class has data members and accompanying accessor and mutator methods for each of the following six data items. (This involves creating the file Employee.java.)
* id (string) * name (string) * salary (double) * department (string) * position (string) * years of service (integer) 2. Create a text (data) file containing data for at least five different employees (objects). Let each data item sit on its own line in the text file. For example, the first six lines of the file might look like: 086244 Sally L. Smith 100000.00 Accounting Manager 7 3. ‘Heap’ is a tree-based data-structure that satisfies the heap property. A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the children of that node. By having a heap (or an array that satisfies the heap property), it would be more efficient (generally faster) to perform important tasks on the array such as finding the maximum element in the array (and removing it) and sorting the array. In this assignment, you will have to write a program that reads a list of employees from a file. The name of the file will be ‘Employee.txt’. The program should output the *sorted* array to a file called “SortedEmployee.txt” You MUST include Employee.txt in your project submission. PROGRAM MUST USE GENERIC, AND WRAPPER CLASS. NO PRIMITIVE DATA TYPES.
Define a Java class called Employee. The class has data members and accompanying accessor and mutator methods for each of the following six data items. (This involves creating the file Employee.java.)
* id (string) * name (string) * salary (double) * department (string) * position (string) * years of service (integer) 2. Create a text (data) file containing data for at least five different employees (objects). Let each data item sit on its own line in the text file. For example, the first six lines of the file might look like: 086244 Sally L. Smith 100000.00 Accounting Manager 7 3. ‘Heap’ is a tree-based data-structure that satisfies the heap property. A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the children of that node. By having a heap (or an array that satisfies the heap property), it would be more efficient (generally faster) to perform important tasks on the array such as finding the maximum element in the array (and removing it) and sorting the array. In this assignment, you will have to write a program that reads a list of employees from a file. The name of the file will be ‘Employee.txt’. The program should output the *sorted* array to a file called “SortedEmployee.txt” You MUST include Employee.txt in your project submission.

Explanation / Answer

here is your file : ------------>>>>>>>>>>

public class Employee{
private String id;
private String name;
private Double salary;
private String department;
private String position;
private Integer year;

public void setID(String id){
  this.id = new String(id);
}

public void setName(String name){
  this.name = new String(name);
}

public void setSalary(Double salary){
  this.salary = new Double(salary);
}

public void setDepartment(String department){
  this.department = new String(department);
}

public void setPosition(String position){
  this.position = new String(position);
}

public void setYearOfService(Integer year){
  this.year = new Integer(year);
}

public String getID(){
  return id;
}

public String getName(){
  return name;
}

public Double getSalary(){
  return salary;
}

public String getDepartment(){
  return department;
}

public String getPosition(){
  return position;
}

public Integer getYearOfService(){
  return year;
}
}

import java.util.Scanner;
import java.io.File;
import java.io.PrintWriter;
import java.util.Arrays;

public class EmployeeTest{
public static void main(String[] args) {
  Integer MAX = 30;
  Employee[] employees = new Employee[MAX];
  try{
   Scanner sc = new Scanner(new File("Employee.txt"));
   Integer i = 0;
   while(sc.hasNextLine()){
    employees[i.intValue()].setID(sc.nextLine());
    employees[i.intValue()].setName(sc.nextLine());
    employees[i.intValue()].setSalary(Double.parseDouble(sc.nextLine()));
    employees[i.intValue()].setDepartment(sc.nextLine());
    employees[i.intValue()].setPosition(sc.nextLine());
    employees[i.intValue()].setYearOfService(Integer.parseInt(sc.nextLine()));
    i = new Integer(i.intValue() + i);
   }
   sc.close();
  }catch(Exception e){
   System.out.println("File Not Found ");
   System.exit(0);
  }
  Arrays.sort(employees);

  try{
   PrintWriter pw = new PrintWriter(new File("SortedEmployee.txt"));
   Integer i = 0;
   while(employees[i.intValue()] != null){
    if(i.compareTo(new Integer(30)) >= 0){
     break;
    }
    pw.println(employees[i].getID());
    pw.println(employees[i].getName());
    pw.println(employees[i].getSalary());
    pw.println(employees[i].getDepartment());
    pw.println(employees[i].getPosition());
    pw.println(employees[i].getYearOfService());
   }
   pw.close();
  }catch(Exception e){
   System.out.println("File Creating Error ");
   System.exit(0);
  }
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote