Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help me with this? Thank you In our simulation, a challenge will be represented by a list of tasks as defined by

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Can you please help me with this? Thank you

In our simulation, a challenge will be represented by a list of tasks as defined by the provided Task class. You will be responsible for implementing several specific types of tasks, as follows: - EnduranceTask - tasks that test endurance by requiring contestants to repeat a single action many times in a row e.g. jumping over a series of hurdles, hanging from a wall for an extended period of time, swimming a number of laps in a pool or lake - Precisiontask - tasks that test skill and accuracy by requiring contestants to take a particular set of actions in a particular order e.g. completing an obstacle course, pushing a series of buttons in a particular order - PuzzleTask - tasks that test intelligence or memory by requiring constants to solve a puzzle or riddle e.g. solving a math problem - One additional task type of your choice that extends one of the above task types e.g. a strength task, a speed task, a balance task, or any other task you can think of! Each type of task will be represented by a single class, which should (directly or indirectly) extend the Task class specified in Task.java. See the source file for the required methods. Sample Simulation Here is an example of how the simulation might run when the required classes are fully implemented. This output was produced using the provided client.java and a reference solution for all subclasses of the Task class. You are not required to exactly match this output format and text, but you must not modify client.java (see below). In the below example, user input is bold and underlined: Current task: A set of three hurdles. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Current task: A set of three hurdles. Previous actions: [jump] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Current task: A set of three hurdles. Previous actions: [jump, jump] Possible actions: [jump, run, swim, crawl, climb] Your action? swim Action not successful. Current task: A set of three hurdles. Previous actions: [jump, jump] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Task completed! Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? fly. Invalid action: fly** Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? run Action not successful. Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? swim Action successful! Task completed! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? crawl Action successful! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? crawl Action not successful. Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? climb Action successful! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [climb, crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? run Action successful! Task completed! Current task: What is 2+2 ? Previous actions: [] Possible actions: [hint, solve solution>] Your action? hint Action successful! Current task: What is 2+2? HINT: It's 4 . Previous actions: [hint] Possible actions: [hint, solve ] Your action? solve 22 Action not successful. Current task: What is 2+2? HINT: It's 4 . Previous actions: [hint] Possible actions: [hint, solve ] Your action? solve 4 Action successful! Task completed! Challenge complete. Congratulations!!! Implementation Requirements Each type of task should be represented by a class that extends the Task class. You should utilize inheritance to capture common behavior among similar task types and eliminate as much redundancy between classes as possible. Your classes should be implemented so that the client program in client.java works as written. In particular, your implementations must not rely on any public methods beyond those specified in the Task interface. (You are welcome to add additional public or private helper methods, but your classes must be able to be utilized by the client without calling these methods directly.) Required Constructors Each of the required classes should have the following constructors (you may include additional constructors if you wish): public EnduranceTask(String type, int duration, String description) - String type - the type of task, which is also the action required to complete the task This must be one of the valid actions for this task type - int duration - the number of times the action must be taken to complete the task - String description - a text description of the task public PrecisionTask(List requiredActions, String description) - List requiredActions - the sequence of actions that are required to complete the task Each action must be one of the valid actions for this task type Actions need to be completed in order to complete the task - String description - a text description of the task public PuzzleTask(String solution, List hints, String description) - String solution - the expected solution for this task The solution will be provided with the "solve" action - List hints - an ordered list of hints to be provided to the client when taking the "hint" action May be empty if there are no hints If all hints have already been given (including if there are no hints), takeAction() should return false for the hint action. - String description - a text description of the task Finally, all implementations of a task must throw an Il legalArgumentException in takeAction() in the event o You may add one or more lines of code after line 11 of client.java to create additional tasks (including at least one instance of your custom task type), and you may create any additional variables or data to pass to constructors as parameters. But you should not otherwise modify the client, and in particular, you should not modify the attemptchallenge method. Implement your classes so that the client works as written. /home/Task.java Spaces: 4 (Auto) In our simulation, a challenge will be represented by a list of tasks as defined by the provided Task class. You will be responsible for implementing several specific types of tasks, as follows: - EnduranceTask - tasks that test endurance by requiring contestants to repeat a single action many times in a row e.g. jumping over a series of hurdles, hanging from a wall for an extended period of time, swimming a number of laps in a pool or lake - Precisiontask - tasks that test skill and accuracy by requiring contestants to take a particular set of actions in a particular order e.g. completing an obstacle course, pushing a series of buttons in a particular order - PuzzleTask - tasks that test intelligence or memory by requiring constants to solve a puzzle or riddle e.g. solving a math problem - One additional task type of your choice that extends one of the above task types e.g. a strength task, a speed task, a balance task, or any other task you can think of! Each type of task will be represented by a single class, which should (directly or indirectly) extend the Task class specified in Task.java. See the source file for the required methods. Sample Simulation Here is an example of how the simulation might run when the required classes are fully implemented. This output was produced using the provided client.java and a reference solution for all subclasses of the Task class. You are not required to exactly match this output format and text, but you must not modify client.java (see below). In the below example, user input is bold and underlined: Current task: A set of three hurdles. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Current task: A set of three hurdles. Previous actions: [jump] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Current task: A set of three hurdles. Previous actions: [jump, jump] Possible actions: [jump, run, swim, crawl, climb] Your action? swim Action not successful. Current task: A set of three hurdles. Previous actions: [jump, jump] Possible actions: [jump, run, swim, crawl, climb] Your action? jump Action successful! Task completed! Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? fly. Invalid action: fly** Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? run Action not successful. Current task: A small lake. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? swim Action successful! Task completed! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [] Possible actions: [jump, run, swim, crawl, climb] Your action? crawl Action successful! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? crawl Action not successful. Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? climb Action successful! Current task: A low crawl net, then a wall with a rope, then a dash to the end. Previous actions: [climb, crawl] Possible actions: [jump, run, swim, crawl, climb] Your action? run Action successful! Task completed! Current task: What is 2+2 ? Previous actions: [] Possible actions: [hint, solve solution>] Your action? hint Action successful! Current task: What is 2+2? HINT: It's 4 . Previous actions: [hint] Possible actions: [hint, solve ] Your action? solve 22 Action not successful. Current task: What is 2+2? HINT: It's 4 . Previous actions: [hint] Possible actions: [hint, solve ] Your action? solve 4 Action successful! Task completed! Challenge complete. Congratulations!!! Implementation Requirements Each type of task should be represented by a class that extends the Task class. You should utilize inheritance to capture common behavior among similar task types and eliminate as much redundancy between classes as possible. Your classes should be implemented so that the client program in client.java works as written. In particular, your implementations must not rely on any public methods beyond those specified in the Task interface. (You are welcome to add additional public or private helper methods, but your classes must be able to be utilized by the client without calling these methods directly.) Required Constructors Each of the required classes should have the following constructors (you may include additional constructors if you wish): public EnduranceTask(String type, int duration, String description) - String type - the type of task, which is also the action required to complete the task This must be one of the valid actions for this task type - int duration - the number of times the action must be taken to complete the task - String description - a text description of the task public PrecisionTask(List requiredActions, String description) - List requiredActions - the sequence of actions that are required to complete the task Each action must be one of the valid actions for this task type Actions need to be completed in order to complete the task - String description - a text description of the task public PuzzleTask(String solution, List hints, String description) - String solution - the expected solution for this task The solution will be provided with the "solve" action - List hints - an ordered list of hints to be provided to the client when taking the "hint" action May be empty if there are no hints If all hints have already been given (including if there are no hints), takeAction() should return false for the hint action. - String description - a text description of the task Finally, all implementations of a task must throw an Il legalArgumentException in takeAction() in the event o You may add one or more lines of code after line 11 of client.java to create additional tasks (including at least one instance of your custom task type), and you may create any additional variables or data to pass to constructors as parameters. But you should not otherwise modify the client, and in particular, you should not modify the attemptchallenge method. Implement your classes so that the client works as written. /home/Task.java Spaces: 4 (Auto)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions