Question: Task.java: Defines a Task object. Each Task contains a priority level, task type, waiting time, hour created and description. The Task class should implement the

Task.java: Defines a Task object. Each Task contains a priority level, task type, waiting time, hour created and description. The Task class should implement the TaskInterface and the Comparable interface. There is a Enumeration class given within TaskInterface that details the specific types of tasks. This enumeration should not be altered.

here is the task interface ===>

public interface TaskInterface {

/**

* Enum for the six different types of Tasks.

*/

public enum TaskType {

MINING(100, 20, 0.1, 0.05),

FISHING(150, 20, 0.1, 0),

FARM_MAINTENANCE(25, 10, 0.1, 0),

FEEDING(75, 10, 0.1, 0),

FORAGING(75, 0, 0, 0),

SOCIALIZING(25, 0, 0, 0);

private final int moneyPerHour;

private final int energyPerHour;

private final double passingOutProbability;

private final double dyingProbability;

TaskType(int moneyPerHour, int energyPerHour, double passingOutProbability, double dyingProbability) {

this.moneyPerHour = moneyPerHour;

this.energyPerHour = energyPerHour;

this.passingOutProbability = passingOutProbability;

this.dyingProbability = dyingProbability;

}

public int getMoneyPerHour()

{

return moneyPerHour;

}

public int getEnergyPerHour()

{

return energyPerHour;

}

public double getPassingOutProbability()

{

return passingOutProbability;

}

public double getDyingProbability()

{

return dyingProbability;

}

}

/**

* Returns the priority.

*

* @return the priority

*/

public int getPriority();

/**

* Sets the priority to the specified value.

*

* @param priority

*/

public void setPriority(int priority);

/**

* Gets the waiting time of a task.

*

* @return - Task.TaskType - the Task's type

*/

public Task.TaskType getTaskType();

/**

* Increments the waiting time by one.

*/

public void incrementWaitingTime();

/**

* Resets the waiting time to 0.

*/

public void resetWaitingTime();

/**

* Gets the waiting time of a task.

*

* @return the waiting time

*/

public int getWaitingTime();

/**

* {@inheritDoc}

*/

public String toString();

}

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!