[solved]-Task Requirements Instance Variables Every Task Following Instance Variables Aka Attribute Q39084322
Task Requirements
Instance Variables
Every task will have the following instance variables(aka. attributes).
-
A description.
-
A priority (this will can be any integervalue).
-
Whether or not the task is complete.
Constructors
To give the user flexibility in how they create a task,we will provide the following overloaded constructors. Make sure toinitialize ALL instance variables in both methods. Think about thedefault values you will use if a value is not passed as aparameter.
-
Task(String description)
-
Task(String description, int priority)
toString Method
Write a toString method that will return a Stringrepresenting the state of the task in the following format. If thetask is complete, prepend “[X]” before the description, elseprepend “[ ]”.
Incomplete task output format:
[ ] description, priority
Complete task output format:
[X] description, priority
Getters/Setters (Accessors/Mutators)
Provide getter and setter methods for all of theinstance variables.
-
getDescription, setDescription
-
getPriority, setPriority
-
isComplete, setComplete
TaskMaster Requirements
In your TaskMaster “driver” class, you will test theconstructors and methods of your Task class by creating two Taskinstances.
Task 1
-
Use the constructor that takes in a description tocreate a new Task object, named task1.
-
Print task1 to verify that your toString method works asexpected.
-
Set task1 to complete using the setComplete method andverify the value was set correctly using your isCompletemethod.
-
Print task1 again to verify that your toString methodstill works as expected.
Task 2
-
Use the constructor that takes in a description andpriority to create a new Task object, named task2 with priority10.
-
Print task2 to verify that your toString method works asexpected.
-
Change the priority of task2 to 20 using the setPrioritymethod and verify the value was set correctly using yourgetPriority method.
-
Print task2 again to verify that your toString methodstill works as expected.
Sample Output
When you are done, your output should look somethinglike the following:
Task 1
[ ] Finish Activity 14, 0
Task 1 is complete: true
[X] Finish Activity 14, 0
Task 2
[ ] Give Tigger a bath, 10
Task 2 priority: 20
[ ] Give Tigger a bath, 20
Expert Answer
Answer to Task Requirements Instance Variables Every task will have the following instance variables (aka. attributes). A descript… . . .
OR

