logo

Employee Class with Instance Variables and Methods

   

Added on  2019-10-16

2 Pages292 Words253 Views
 | 
 | 
 | 
public class Employee {//To-Do: Declare three instance variables: //1) employee’s name (string), //2) attendanceRate (double), //3) hoursWorked (integer).//To-Do: Declare a static variable for tracking the number of employee objects created // -----------------------------------------------------------------// A constructor // -----------------------------------------------------------------public Employee(String newName, double newAR, int newHours) {//To-Do: use newName, newAR, newHours to initialize instance data//To-Do: increase the value of the static variable for tracking the number of employee objects created }//To-Do: Include get and set methods for the three instance variables.//For example, this is a set method for an employee’s name //public void setName(String input_name){//name = input_name;//}//And, this is an example get method for employee's name//public String getName(){//return name;//}//This is an instance method called isEligibleForBonus() that returns a boolean.
Employee Class with Instance Variables and Methods_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents