Question: Java Q3. Working (60 points) Complete the Timecard class following the instructions below. public class Timecard { i. static (5 points) Declare two class variables,

 Java Q3. Working (60 points) Complete the Timecard class following the

instructions below. public class Timecard { i. static (5 points) Declare two

class variables, minStartHour and maxEndHour. Both variables are of type int. Initialize

minStartHour to be 7, and maxEndHour to be 20. Other classes can

Java

Q3. Working (60 points) Complete the Timecard class following the instructions below. public class Timecard { i. static (5 points) Declare two class variables, minStartHour and maxEndHour. Both variables are of type int. Initialize minStartHour to be 7, and maxEndHour to be 20. Other classes can read and change the values of these variables. I ii. Instance variables (5 points) Declare two instance variables, name and email. Both variables are of type String. Other classes should not be able to change the values of these variables. iii. More instance variable (5 points) Declare a private instance variable hours of type int[] . I 6 iv. Constructor (10 points) Write a constructor that initializes name and email with the parameter variables. Initialize hours with an array of size 365. v. Adding Hours (25 points) Write a method called addHours that returns a boolean. addHours takes an int parameter startHour, an int parameter endHour and an int pa- rameter day. Assume that the hours are in the 24 hour format. You should compute the total hours worked and set it to hours in the index day only if minStartHoursstartHour and endHour(maxEndHour. If the hours have been logged correctly, the method should return true. The method should return false if any input is invalid. I vi. getAvgHours (10 points) Write a method called getAvgHours. getAvgHours has no parameters and returns a double containing the average of numbers stored in hours. For example, if hours contains 4 and 5, then hours should return 4.5. Make sure to iterate through all values in hours

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!