Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

RegularAction is just a subclass of Action: true Expected: true RegularAction activities have no extra fields:true Expected: true Looking at regular actions: Wash your hands

RegularAction is just a subclass of Action: true Expected: true RegularAction activities have no extra fields:true Expected: true Looking at regular actions: Wash your hands Expected: Wash your hands true Expected: true

 

SAMPLE OUTPUT FOR PART 2

OccasionalAction is subclass of Action: true Expected: true RareAction is subclass of Action: true Expected: true OccasionalAction have no extra fields:true Expected: true RareAction have no extra fields:true Expected: true


SAMPLE OUTPUT FOR PART 3

Enter a date (like 2010 01 30): 2022 05 01 These are your actions on 05/01/2022: Wash your hands. Take a PCR test. Sit two meters apart.

Enter a date (like 2018 01 30): 2022 12 15 These are your actions on 12/15/2022: Wash your hands. Get a booster shot. Sit two meters apart.

Enter a date (like 2018 01 30): 2022 06 01 These are your actions on 06/01/2022: Wash your hands. Take a PCR test. Get a booster shot. Sit two meters apart.

Enter a date (like 2018 01 30): 2022 02 26 These are your actions on 02/26/2022: Wash your hands Sit two meters apart

-------------------------------------------------------

In this assignment, you will work with important concepts such as inheritance, abstraction, arrays, code documentations etc. This is an individual assignment and you are not allowed to work or submit the assignment with anyone else. Problem Statement Most people in Ontario especially small businesses have been adversely affected by the lock-down situation in the province due to COVID-19 for about two years. The Ontario Public Health (OPH) office has the task of creating a strategic plan for the gradually re-opening of schools and business places. The strategic plan by OPH must specify actions that must be undertaken by schools and businesses following a certain routine. The routine approved would indicate actions that must be regular, occasional and rare on given dates in a year. For example, the regular actions by schools and businesses will be done daily. Occasional actions will be done on a specific day of each month, while actions classified as rarely will be done only on a certain day of the year. OPH knows the reputation of ICT-AP department at Algonquin College and has enlisted a team of five students from the department, which includes yourself, to implement a system that will provide details all categories of actions that should be taken by schools and businesses on a specific date so that any user can access and retrieve relevant actions (regular, occasional and rare) to ensure compliance with OPH directives. Users of this system your team is implementing can enter a date of their choice and obtain all actions stipulated for that date as output. In this assignment, you have been provided with:

- Some code files to help you get started. - A sample output to guide your solution You are required to read all documents carefully and completely to understand what to do and how to do it. Certain comments have also been included in the code to guide your work. Missing such comments will make your implementation difficult. Some helpful links have also been uploaded for you. This assignment has three parts. Note that you are required to comprehensively document your work using Javadoc style documentation in every relevant section of your code clearly describing what you have done. All tasks in this assignment needs to be completed and demonstrated in order to get your marks. HOW DO I SUBMIT MY ASSIGNMENT? WHAT DO I SUBMIT? You must submit your solutions (diagrams and source code) including the generated Javadoc file on the specified portal on Brightspace.

YOUR TASKS: 1. You are required to draw a representation of the inheritance hierarchy between the classes provided in this assignment. You do NOT need to show the variables, methods or constructors in the classes. Do not use auto-generating apps. You can use UMLet or MS Word tools only. 2. Inspect the starter-code files provided for you. There are loopholes you are expected to fill.

PART 1 In this part of the assignment, you will work with and submit three code files. You are required to: 1. Review the starter-code that has been supplied for you actions named Action.java. 2. This Superclass (Action.java) has a subclass named RegularAction.java. 3. Action has a description and could be carried out on one or more dates. An example of a description could be "Wash your hands" or "Wear a face mask". 4. You should write an abstract method in the Superclass named occursOn(). This abstract method has parameters year, month and day which checks if the action occurs on that specific date. 5. Complete the starter-code provided for you on the RegularAction class (this shows the actions that happened regularly on an everyday basis). Hint: Observe the sample output provided to you for compliance. 6. Write an ActionDriver class that contains the main method to run your code. In writing the class named ActionDriver.java carefully follow the pattern of the output that has been provided. Instantiate required action objects to test this portion of your code.

- If you give me a hand, it would be deadly pleasant to me. Thanks.

1. Action.java

/**
This is the Action Superclass class that provides a catalog of actions to be carried out in view of COVID-19 OPH protocols.
You are required to complete read and review this code to appropriately fill the required loopholes.
*/
public class Action
{
private String description;

/**
   Constructs an action without a description.
*/
public Action()
{
   description = "";
}

/**
   Sets the description of this action.
   @param description the text description of the action
*/
public void setDescription(String description)
{
   this.description = description;
}

/**
   Determines if this action occurs on the specified date.
   @param year the year
   @param month the month
   @param day the day
   @return true if the action activity occurs on the specified date.
*/

/**
YOUR TASK - TO DO: Write your abstract method named occursOn() here.
*/

/**
   Converts action activity to string description.
*/
public String toString()
{
   return description;
}
}


2. OccasionalAction.java


/**
   In this file you will provide the code solution for Part 2.
   You are required to create a subclass named OccasionalAction.
   These are activities that occur on the same day of every month specified.
*/

// YOUR CODE STARTS HERE!!!

public class . . .
{
   . . .
   
3. RareAction.java

/**
   In this file you will provide the code solution for Part 2.
   You are required to create a subclass named RareAction.
   Activities for RareAction occurs on a particular date of the year specified.
*/

// YOUR CODE STARTS HERE!!!
public class . . .
{
   . . .
   
4. RegualrAction.java

/**
   This is code for Part 1.
   YOUR TASK is to create a subclass named RegularAction. This is
   a subclass of the Action Superclass.
   Action has a description (for example,
   "Wash your hands") and occurss on one or more dates.
   A regularaction activity occurs every day.
*/

//YOUR CODE STARTS HERE!!!!

public class . . .
{
   . . .
   
5. AllActionTest.java

import java.util.Scanner;
/**
   In this file, you are required to write code for your part Part 3.
   The reason for this class is to demonstrate the Action class and subclasses.
   You must fill an array of action objects (hint: check the sample output file provided for you) with
   different action activities. A user of this system should be able to input a date of their choice and
   retrieve an output of all activities that would occur on that date.
   You should reuse the Action class and RegularAction classes from Part I of your solution
   and then the OccasionalAction and RareAction classes from your Part 2.
*/

// YOUR CODE STARTS HERE!!!

public class AllActionTest
{
   public static void main(String[] args)
   {
      . . .

 


Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Part 1 Action and RegularAction Define Action Class Create an abstract class named Action Include a private field description to store the action description Create a onearg constructor to set ... 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

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Programming questions