Question: Please adapt the code below to JavaFX . Sample application's screenshots are given BELOW . This is a COMBINE of Java and JavaFX so JavaFX

Please adapt the code below to JavaFX. Sample application's screenshots are given BELOW. This is a COMBINE of Java and JavaFX so JavaFX IS NEEDED.

PayableInterfaceTest.java ------------------------------------------------------------ public class PayableInterfaceTest{

public static void main(String[] args) {

Payable[] payableObjects = new Payable[6];

payableObjects[0] = new Invoice("01234", "seat", 2, 375.00); payableObjects[1] = new Invoice("56789", "tire", 4, 79.95); payableObjects[2] = new SalariedEmployee("John", "Smith", "111-11-1111", 800.00); payableObjects[3] = new HourlyEmployee("Bob", "Marley", "222-22-2222", 33.00, 40); payableObjects[4] = new CommissionEmployee("Jessica", "Johnson", "333-33-3333", 1350, 0.85); payableObjects[5] = new BasePlusCommissionEmployee("Jenny", "James", "666-66-6666", 1175, 0.95, 660.00);

System.out.println( "Invoices and Employees processed polymorphically: ");

for(Payable currentPayable : payableObjects){ System.out.printf("%s %s: $%,.2f ", currentPayable.toString(), "Payment due", currentPayable.getPaymentAmount()); }

for (Payable currentPayable : payableObjects){ if(currentPayable instanceof BasePlusCommissionEmployee){ BasePlusCommissionEmployee employee = (BasePlusCommissionEmployee)currentPayable; double employeePay = employee.getBaseSalary(); double newSalary = employeePay + (employeePay * .10); employee.setBaseSalary(newSalary);

System.out.printf("The base pay of " + employee.getFirstName() + " " + employee.getLastName() + " with a 10%% raise is %.2f ", newSalary); }

} } } ------------------------------------------------------------------------------------------------------------ BasePlusCommissionEmployee.java ------------------------------------------------------------------ public class BasePlusCommissionEmployee extends CommissionEmployee { private double baseSalary; public BasePlusCommissionEmployee(String first, String last, String ssn, double sales, double rate, double salary){ super(first, last, ssn, sales, rate); setBaseSalary(salary); }

public void setBaseSalary(double salary){ if(salary >= 0.0){ baseSalary = salary; }else{ throw new IllegalArgumentException( "Base salary must be >= 0.0"); } }

public double getBaseSalary(){ return baseSalary; }

@Override public double getPaymentAmount(){ return getBaseSalary() + super.getPaymentAmount(); }

@Override public String toString(){ return String.format("%s %s; %s: $%,.2f", "Base-salaried", super.toString(), "Base salary", getBaseSalary()); } } ------------------------------------------------------------------------------------------------ CommissionEmployee.java ------------------------------------------------------------ public class CommissionEmployee extends Employee { private double grossSales; private double commissionRate;

public CommissionEmployee(String first, String last, String ssn, double sales, double rate){ super(first, last, ssn); setGrossSales(sales); setCommissionRate(rate); }

public void setCommissionRate(double rate){ if(rate > 0.0 && rate 0.0 and

public double getCommissionRate(){ return commissionRate; }

public void setGrossSales(double sales){ if(sales >= 0.0){ grossSales = sales; }else{ throw new IllegalArgumentException( "Gross sales must be >= 0.0"); } }

public double getGrossSales(){ return grossSales; }

@Override public double getPaymentAmount(){ return getCommissionRate() * getGrossSales(); }

@Override public String toString(){ return String.format("%s: %s %s: $%,.2f; %s: %.2f", "Commission employee", super.toString(), "Gross sales", getGrossSales(), "Commission rate", getCommissionRate()); }

} ----------------------------------------------------------------------------------------------- Employee.java ------------------------------------------------ public abstract class Employee implements Payable{ private String firstName; private String lastName; private String socialSecurityNumber;

public Employee(String firstName, String lastName, String socialSecurityNumber) { this.firstName = firstName; this.lastName = lastName; this.socialSecurityNumber = socialSecurityNumber; }

public String getFirstName() { return firstName; }

public void setFirstName(String firstName) { this.firstName = firstName; }

public String getLastName() { return lastName; }

public void setLastName(String lastName) { this.lastName = lastName; }

public String getSocialSecurityNumber() { return socialSecurityNumber; }

public void setSocialSecurityNumber(String socialSecurityNumber) { this.socialSecurityNumber = socialSecurityNumber; }

@Override public String toString(){ return String.format("%s %s Social Security number: %s", getFirstName(), getLastName(), getSocialSecurityNumber()); } } -------------------------------------------------------------------------------------------------- HourlyEmployee.java --------------------------------------------------------- public class HourlyEmployee extends Employee { private double wage; private double hours;

public HourlyEmployee(String first, String last, String ssn, double hourlyWage, double hoursWorked){ super(first, last, ssn); setWage(hourlyWage); setHours(hoursWorked); }

public void setWage(double hourlyWage){ if(hourlyWage >= 0.0){ wage = hourlyWage; }else{ throw new IllegalArgumentException( "Houly wage must be >= 0.0"); } }

public double getWage(){ return wage; }

public void setHours(double hoursWorked){ if ((hoursWorked >= 0.0)&&(hoursWorked = 0.0 and

public double getHours(){ return hours; }

@Override public double getPaymentAmount(){

if(getHours()

@Override public String toString(){ return String.format("Hourly employee: %s %s: $%,.2f; %s: %,.2f", super.toString(), "Hourly wage", getWage(), "Hours worked", getHours()); } } ------------------------------------------------------------------------------------------------------- Invoice.java -------------------------------------------- public class Invoice implements Payable{

private String partNumber; private String partDescription; private int quantity; private double pricePerItem;

public Invoice(String part, String description, int count, double price){ partNumber = part; partDescription = description; setQuantity(count); setPricePerItem(price); }

public String getPartNumber() { return partNumber; }

public void setPartNumber(String partNumber) { this.partNumber = partNumber; }

public String getPartDescription() { return partDescription; }

public void setPartDescription(String partDescription) { this.partDescription = partDescription; }

public int getQuantity() { return quantity; }

public void setQuantity(int quantity) { if(quantity >= 0){ this.quantity = quantity; }else{ throw new IllegalArgumentException("Quantity must be >=0"); } }

public double getPricePerItem() { return pricePerItem; } public void setPricePerItem(double pricePerItem) { if(pricePerItem >= 0){ this.pricePerItem = pricePerItem; }else{ throw new IllegalArgumentException( "Price per item must be >=0"); } }

@Override public String toString(){ return String.format("%s: %s: %s (%s) %s: %d %s: $%,.2f", "Invoice", "Part number", getPartNumber(), getPartDescription(), "Quantity", getQuantity(), "Price per item", getPricePerItem()); }

@Override public double getPaymentAmount(){ return getQuantity()*getPricePerItem(); } } ----------------------------------------------------------------------------------------------------- Payable.java ------------------------------------------------- public interface Payable {

double getPaymentAmount(); } ------------------------------------------------------------------------------------------------- SalariedEmployee.java -------------------------------------------------------------- public class SalariedEmployee extends Employee{

private double weeklySalary;

public SalariedEmployee(String firstName, String lastName, String socialSecurityNumber, double weeklySalary) { super(firstName, lastName, socialSecurityNumber); setWeeklySalary(weeklySalary); }

public double getWeeklySalary() { return weeklySalary; }

public void setWeeklySalary(double weeklySalary) { if(weeklySalary >= 0.0){ this.weeklySalary = weeklySalary; }else{ throw new IllegalArgumentException( "Weekly salary must be >= 0.0"); } }

@Override public double getPaymentAmount(){ return getWeeklySalary(); }

@Override public String toString(){ return String.format("Salaried employee: %s %s: $%,.2f", super.toString(), "Weekly salary", getWeeklySalary()); } }

Please adapt the code below to JavaFX. Sample application's screenshots are givenBELOW. This is a COMBINE of Java and JavaFX so JavaFX IS

EMPLOYEE SALARY CALCULATOR Choose Employee Type Salaried Employee First Name Hourly Employee Commission Employee Last Name Base Plus Commission Employee 5SN None Search/Update SSN Weekly Salary SALARY VALUE Wage Hours EMPLOYEE SALARY CALCULATOR Choose Employee Type Salaried Employee First Name John Gross Sales Last Name Smith Commission Rate 5SN Base Salary Search/Update SSN Weekly Salary SALARY Wage Hours Add \begin{tabular}{|l||l|l} Search by SSN & Update by SSN & Clean textfields \end{tabular} 1- Your program should store, add, update and search salary information of all type employees as shown in figures above. Use random access file(.dat) or text file (.txt) for reading and writing, an employee information. - Program should perform Add, Search by SSN, Update by SSN CleanTextFields operations. - SSN text field should be "read only" and SSN should be set in the code for each record, do not take from user. - When program starts, read all records from random access file or text file and save each record in Employee []. (Employee array) - Update both Employee [] and random access file or text file when add and update operations happen. - Add: Select employee type from dropdown list. According to your selection, related text fields are enabled, unrelated text fields are disabled (Search/Update SSN text field always enabled). Enter employee information into enabled text fields, then press "add button". Your employee record will be written into file. Also add that record into your Employee[] - Search by SSN: Enter SSN of employee whose information you want to reach, into "Search/Update SSN text field". Press "Search by SSN button". Then all information related to the employee will be displayed, such as employee type, first name, last name, SSN, salary etc.. - Update by SSN: Enter SSN of employee whose information you want to update, into "Search/Update SSN text field". Enter other fields you want to update, then press "Update by SSN button". Employee record which is placed in file should be updated. Also, Employee[] should be updated. - Clean TextFields: Cleans all text fields

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!