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

Create a project called P03. Inside of P03 you’re going to have four classes: 1)

ID: 3871882 • Letter: C

Question

Create a project called P03. Inside of P03 you’re going to have four classes:
1) EntrySystem.java (which will contain your main method)

2) Person.java which will be your super class will have the following properties:
first name (string)
last name (string)
id number (string)
phone (string)
street address (string)
city (string)
state (string)
zip (string)

3) Student.java will inherit from Person and will have the following additional properties:
major (string)
grades (Arraylist of doubles)
advisor (string)

Student will also have a method called displayStudent() which will display all of the students information as well as their GPA in a neatly formatted way

. 4) Employee.java will inherit from Person and will have the following additional properties:
department (string)
supervisor (string)
paychecks (ArrayList of doubles)

Employee will also have a method called displayEmployee() which will display all of the employees information as well as their pay average and pay total in a neatly formatted way. You can also add and use the HelperClass.java.
You'll create two interfaces:
PayrollInterface.java with the following methods:
AddCheckAmount(double check)
GetPayTotal()
GetPayAverage()

GradesInterface.java with the following methods:
AddNumericalGrade(double grade)
CalculateGPA()

you will use Student to create an ArrayList of Student Java Objects called students, and Employee to create an ArrayList of Employee Java Objects called employees.

In EntrySystem.java you’ll have a menu with the following options:
1) Add a Student
2) Add a Student Grade
3) View All Students
4) Clear all Students
5) Add an Employee
6) Add an Employee Pay Amount
7) View All Employees
8) Clear All Employees
9) Exit
If 1 is selected,you will prompt the user for each field of the Student class to enter. You will validate strings to make sure they are not empty. You will validate ints and doubles to make sure they are proper ints and doubles. You will then add the Student Object to an ArrayList called students, returning the user back to the menu. Feel free to use the Helper Class we've been working with.

If 2 is selected you will promt the user for a grade (double) from 0-100. Only allow them to enter one grade and then display the main menu again.

If 3 is selected, you will display the list of students in a neatly formatted way by looping through students and calling displayStudent() for each. If there are no students entered, then tell the user this.

If 4 is selected, you will clear the students ArrayList.

If 5 is selected, then you will prompt the user for each field to enter for the Employee class. You will validate strings to make sure they are not empty. You will validate doubles to make sure they are proper doubles. Feel free to use the Helper Class we've been working with.

If 6 is selected, then you will get an employee pay amount from the user. This will be a double. Only allow them to enter one pay amount and then display the main menu again.

If 7 is selected, you will display the list of employees in a neatly formatted way calling displayEmployee() for each. If there are no employees, then tell the user this.

If 8 is selected, you will clear the employees ArrayList.

When 9 is selected, you will exit the program.

Explanation / Answer

import java.util.Scanner;
import java.util.*;
public class HMandTS_Tester
{
public static int menu()
{
    System.out.println("Choose one option from following : ");
    System.out.println("1) Add a new employee.");
    System.out.println("2) Delete an employee via SSN.");
    System.out.println("3) Retrive an employee via SSN.");
    System.out.println("4) List all employees.");
    System.out.println("5) Exit.");
    Scanner sc = new Scanner(System.in);
    return sc.nextInt();
}
public static void main(String[] args)
{
    HashMap<String, Employee> employeesByKey = new HashMap<String, Employee>();
    TreeSet<Employee> employeesByName = new TreeSet<Employee>();
int menuStore = menu();
while(menuStore != 5)
{
    System.out.println();
    switch (menuStore)
    {
      case 1:
        Scanner input1 = new Scanner(System.in);
        System.out.println("Enter a SSN: ");
        String str1 = input1.nextLine();
        System.out.println("Enter Last Name: ");
        String str2 = input1.nextLine();
        System.out.println("Enter First Name: ");
        String str3 = input1.nextLine();
        Employee newEmp = new Employee(str1, str2, str3);
        employeesByKey.put(newEmp.getSSN(), newEmp);
        employeesByName.add(newEmp);
        System.out.println();
        break;
      case 2:
        Scanner input2 = new Scanner(System.in);
        System.out.println("Please enter the SSN of the employee you wish to delete: ");
        String delStr = input2.nextLine();
              if(employeesByKey.containsKey(delStr))
              {
          employeesByKey.remove(delStr);
          Iterator<Employee> iterator;
          iterator = employeesByName.iterator();
          while (iterator.hasNext())
          {
          Employee iterEmp = iterator.next();
          if (delStr.compareTo(iterEmp.getSSN()) == 0)
          {
            iterator.remove();
          }
          }
          System.out.println("Employee removed.");
          System.out.println("");
      }
      else
      {
        System.out.println("No such SSN.");
        System.out.println("");
      }
        break;
      case 3:
        Scanner input3 = new Scanner(System.in);
       System.out.println("Please enter the SSN of the employee you wish to retrive: ");
        String retStr = input3.nextLine();
              if(employeesByKey.containsKey(retStr))
              {
      Employee recievedEmployee = employeesByKey.get(retStr);
      System.out.println(recievedEmployee);
      System.out.println("");
        }
        else
        {
            System.out.println("No such SSN.");
            System.out.println("");
        }
        break;
       case 4:
          Iterator iterator;
    iterator = employeesByName.iterator();
          if (employeesByName.isEmpty())
          {
        System.out.print("Tree Set is empty.");
    }
    else
    {
              while (iterator.hasNext())
        {
        System.out.print(iterator.next() + " ");
        }
    }
          System.out.println("");
    break;

    case 5:
      break;
}
    menuStore = menu();
     }
   }
}

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