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

The main objective of this project is to be able to design, create and utilize c

ID: 3685824 • Letter: T

Question

The main objective of this project is to be able to design, create and utilize classes and objects. You are to write a class based on the following UML diagram. Your class will be called “Employee” and reside in a source file named “Employee.java”.

Assignment Task

_________________________________

The class Employee will be used to define or instantiate objects that contain the fields and the methods defined in the UML diagram above.

The “set” methods will allow data to be passed into an object.

The “get” methods will allow data to be retrieved from an object.

The “input” methods will allow data to be entered (from the keyboard) by a user directly into the instant variables of an object. You may use the Scanner class to handle keyboard input.

The “inputLastname” method will return the boolean value true if a lastname was successfully entered and the value false if a blank was entered.

The “inputAll” method will invoke (call) all the input methds. It will return a boolean value based on the Boolean value returned by the “intputLastname” method. If no last name is entered, none of the other employee information will be prompted for.

The “equals” method will return true if both the last and first names of the current object are equal to the last and first names of the objects passed as an argument. If either the last or first names do not match, the method will return false.

The “toString” method will return a string containing the formatted output. It should look like:
LAST NAME : Murphy
FIRST NAME : Audie
EMPLOYEE ID : 57831
EMPLOYEE PHONE : 619-555-1212
EMPLOYEE SALARY : $40,000.00
BONUS : $2,000.00
MONTHLY PAY : $3,500.00

You may use the main method in the “EmployeeTest” class below to test your class. If you instantiate the Employee class into an object (e.g., person1), the main method is ignored.

public class EmployeeTest
{
public static void main(String[] args)
{
Employee person1 = new Employee();
person1.setLastname( "Murphy" );
person1.setFirstname( "Audie" );
person1.setId( "57831" );
person1.setPhone( "619-555-1212" );
person1.setYearlySalary( 40000 );
person1.calcBonus( 5 );
person1.calcMonthlyPay();
System.out.println( person1 );

System.out.println();
Employee person2 = new Employee();
if ( person2.inputAll())
{
person2.calcBonus( 2 );
person2.calcMonthlyPay();
System.out.println( person2 );
System.out.println( person1.equals( person2 ));
}
else
{
System.out.println( "No EMployee 2" );
}
}   
}

_________________________________________

Sample Output

Grading Critera

Explanation / Answer


}