Question: this is the sample output I need it to come out exactly like this Employee Information Last Name : Murphy First Name : Audie Employee
this is the sample output I need it to come out exactly like this
Employee Information
Last Name : Murphy
First Name : Audie
Employee ID : 57831
Employee Phone : 619
-
555
-
1
212
Yearly Salary : $40000.00
Yearly Bonus : $2000.00
Monthly Salary : $3500.00
Employee No. 2
Enter Last Name : York
Enter First Name : Alvin
Enter Employee Id : 94834
Enter Phone Number : 619
-
555
-
9874
Enter Yearly Salary : $3
6000
Enter Yearly Bonus (%) : 2
Employee Match : false
Employee Information
Last Name : York
First Name : Alvin
Employee ID : 94834
Employee Phone : 619
-
555
-
9874
Yearly Salary : $36000.00
Yearly Bonus : $720.00
Monthly Salary : $306
0.00
Employee No. 3
Enter Last Name :
NO Information for Employee 3
This is test class
public class EmployeeTest { public static final int MAX_EMPLOYEES = 5; /** * @param args the command line arguments */ public static void main(String[] args) { Employee employee[] = new Employee[MAX_EMPLOYEES];
employee[0] = new Employee(); employee[0].setLastName( "Murphy" ); employee[0].setFirstName( "Audie" ); employee[0].setID( "57831" ); employee[0].setPhone( "619-555-1212" ); employee[0].setYearlySalary( 40000 ); employee[0].setBonusPercent( 5 ); System.out.println( employee[0] ); for ( int lp=1; lp Here is my code it wont properly store my entry package employeetest; import java.util.*; /** * * @author tricia */ public class Employee { private String lastName; private String firstName; private String ID; private String phone; private double yearlySalary; private double bonusPercent; private double yearlyBonus; private double percent; public Employee() { } public Employee(String lastName, String firstName, String phone, double yearlySalary, double bonusPercent) { this.lastName = lastName; this.firstName = firstName; this.phone = phone; this.yearlySalary = yearlySalary; this.bonusPercent = bonusPercent; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; } public boolean inputLastName(){ System.out.println("Enter Last Name"); Scanner s = new Scanner(System.in); String str = s.nextLine(); if (str == "") return false; else { setLastName(s.nextLine()); return true; } } public void setFirstName(String firstName) { this.firstName = firstName; } public void inputFirstName(){ System.out.println("Enter First Name"); Scanner s = new Scanner (System.in); setFirstName(s.nextLine()); } public String getID() { return ID; } public void setID(String ID) { this.ID = ID; } public void inputID (){ System.out.println("Enter the ID"); Scanner s = new Scanner(System.in); setID(s.nextLine()); } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public void inputPhone() { System.out.println("Enter The Phone Number"); Scanner s = new Scanner(System.in); setPhone(s.nextLine()); } public double getYearlySalary() { return yearlySalary; } public void setYearlySalary(double yearlySalary) { this.yearlySalary = yearlySalary; } public void inputYearlySalary() { System.out.println("Enter The Yearly Salary"); Scanner s = new Scanner(System.in); setYearlySalary(s.nextDouble()); } public double getBonusPercent() { return bonusPercent; } public void setBonusPercent(double percent) { this.percent= percent; } public void inputBonusPercent() { System.out.println("Enter The Bonus percent % "); Scanner s = new Scanner(System.in); setBonusPercent(s.nextDouble()); } public double calcBonus (){ yearlyBonus = yearlySalary * bonusPercent; return yearlyBonus; } public double calcMonthlyPay (){ double monthlySalary = yearlySalary + yearlyBonus/12; return monthlySalary; } public boolean equals(Employee e) { System.out.println(this.firstName); return true; } @Override public String toString() { String str = ""; str += " LAST NAME: " + lastName + " FIRST NAME: " + firstName + " EMPLOYEE ID: " + ID + " EMPLOYEE PHONE: " + phone + " EMPLOYEE SALARY: " + getYearlySalary() + " BONUS: " + yearlyBonus + "% MONTHLY PAY: " + calcMonthlyPay(); return str; } public boolean inputAll() { if(inputLastName()) { inputFirstName(); inputID(); inputPhone(); inputYearlySalary(); inputBonusPercent(); } return false; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
