Develop an MVC JavaFX GUI application to display a company's payroll report. The application consists of two windows and a java class.

Employee.java

The employee class will have four field variables:

  • First Name
  • Last Name
  • Hourly pay rate
  • Number of hours worked

It will also have the following methods:

  • Non-default constructor to initialize field variables.
  • Getters for field variables.
  • calc Salary which calculates and returns the salary as follows:
    • (up to 40 hours): Hourly pay rate * Number of Hours worked
    • (Number of hours exceeding 40): Hourly pay rate and half * Number of hours worked
  • A public static method called validate which returns true after verifying a new Employee object and making sure that the salary is between 0.00 to 50.00 and the number of hours is between 0.00 to 70.00.
public static boolean validateEmployee (Employee emp) {//...}

GUI

The first window consists of number of TextFields and a button (Add Employee) to get the following information from the user and store them in an ArrayList:

Employee's first name, last name, hourly rate, and hours worked.

NOTE: You must first call the static method validateEmployee to ensure the object is validated.

If the information is invalid, show a warning dialog letting the user know the information were out of range, otherwise add the record to the array.

This first window will have another button (Show Employee). When clicked a second window will open and. The second window will use a Text Area to view the employees and their gross pay.

Employee   Hourly Rate  Hours Worked Gross Pay
Adam Knox $6.50 38 $247.00
Bob Brown $5.70 50 $313.50
Ed Smith $7.00 40 $280.00
Final Total $840.50
  • Make sure each Text Field has an appropriate label
  • Add exception handling to your program in so that it won't crash on bad user input.

Separation between GUI and back-end classes: Remember that you should try to keep the GUI (and back-end classes (other non-GUI classes) as separate and clean as possible. This means don't put any GUI code in the back-end classes, and don't put code in the GUI class(es) that really belongs in a back- end class. To that end your project should consist of separate (java, .fxml and controller classes) for each window in addition to an Employee.java.

Enable the user to use a button (Save Employees) button on the first Window to write the list of employees to a CSV file.

Enable the user to use the (Load Employees) button on the first Window to fill the ArrayList with a list of employees from a CSV file.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.