Problem Statement Most people in Ontario especially small businesses have been adversely affected by the lock-down...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. Additional information slides (PDF) to provide insight into your tasks and the requirements A sample output to guide your solution Grading rubrics to show the possible marks. 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. Since the field(s) used by RegularAction is inherited from its superclass, test that RegularAction has no declared fields of its own. Again, output a String that indicates the test for extra fields in RegularAction, run the appropriate java reflection test, and indicate the expected result. RegularAction activities have no extra fields:true Expected: true ❖ Instantiate a new RegularAction constructor and load it with the message indicated in the sample output. Having loaded an item, you should now be able to output it's description using the object's toString() method. Then output the result of occursOn() and the expected output. Looking at regular actions: Wash your hands Expected: Wash your hands true Expected: true In Part 2 you add two more subclasses, OccasionalAction and RareAction, for items that occur on the same day each month, and only once every year, respectively. Again, the shell of these two class is provided for you, and you must override the occursOn() method so that it returns true or false if the new subclass object's day, month, and year meet the requirement specified for that class. Again, these two new classes should have appropriate constructors and overridden concrete implementations of occursOn(), which returns an appropriate boolean value depending on the requirements of the subclass. Create a new test class, Action Driver2, that includes tests for the following: Test that both test classes have the same superclass, Action ❖ Test the number of fields for each subclass. For the OccasionalAction class, only the day of the month is required for a comparison. For the RareAction class, the day and month are required, hence its constructor would set three fields. ❖ Again, instantiate new instances of both subclasses, load a description, and test the occursOn() method in each. In Part 3 you'll instantiate different Action objects, load them into an array, and perform the tests indicated by the sample output-as described in the first slide. Load an array of Action objects of various types, i.e. Regular, Occasional, and Rare. Create various different descriptions of the tasks to be performed. Instantiate a new Scanner, prompt the user to enter a date as three ints corresponding to year, month, day (clearly indicating the order in which these values are entered) ❖ Loop through the array of Action objects, test each object's occursOn() method against the three int's just entered by the user, and then, whenever the method returns true, print that object's toString() method, displaying the task stored in the object's description field. HOW DO I SUBMIT MY ASSIGNMENT? 1. You must submit your solutions on Brightspace or before the due date. 2. Submit all your solutions through ACTIVITIES >> ASSIGNMENTS >> ASSIGNMENT 1 to Section 300. 3. If your Lab section professor provides an alternative submission information to a designated submission portal, then use that portal which your Professor will create for this assignment. 4. Name your submission using the convention: FirstName_LastName_SectXXX_Assignment1. 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 that generates UML from code. You can use UML editing tools tools only like draw.io, MS Word, MS VISIO or a similar drawing tool. 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 due 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. PART 2 In this part of the assignment, you are required to: 1. Include two more subclasses of the Superclass namely, OccasionalAction and RareAction. OccasionalAction shows actions that are conducted once each month, while RareAction depicts actions that take place only once on a specified day of the year. 2. Complete the starter-code provided for you for the two classes OccasionalAction.java and RareAction.java. Hint: Be guided by observing the sample output provided. 3. Your code must check if the action is carried out on that date. For example, if dealing with an OccasionalAction that happens once a month, your code must ensure that the day of the month matches. 4. Write an Action Driver2 class that contains the main method to run this second part of your code. In writing the class named ActionDriver 2.java carefully follow the pattern of the output that has been provided. Instantiate required action objects that suit both the OccasionalAction and RareAction subclasses. PART 3 In this part of the assignment, you are required to: 1. Create a new class called AllAction Test.java with a main method to demonstrate your work. 2. In this class, create and fill an array of Action objects with different types of actions permitted by Ontario Public Health for the COVID-19 protocol including actions that should occur everyday, actions that occur once a month, and actions designated to occur only on a certain date in a year. 3. Implement your code (entire classes) such that the users can input a date and retrieve an output of all actions that would happen on that date. FIND BELOW THE SAMPLE OUTPUT FOR ASSIGNMENT 1: PART 1 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 Occasional Action is subclass of Action: true Expected: true RareAction is subclass of Action: true Expected: true Occasional Action 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 Assignment 1, you will instantiate various subclasses of the Action class, and store each instance in an array. In Part 3 of the assignment you'll search the array to see if the date of each Action object matches the date requested by the user, i.e. which action task is 'occursOn' that particular date. Whenever it is, that object's description is printed out using its toString() method. Action[] actions action1: regular Due Date: today action1 Input date: 11/19/22 occursOn (11/19/22)? true "wash your hands" action2: occasional action2 occursOn (11/19/22)? false Due Date: anymonth/03/anyyear action3: occasional occursOn (11/19/22)? true action3 Due Date: anymonth/19/anyyear "Take a PCR test" action4: occasional occursOn (11/19/22)? true action4 Due Date: today action5: rare "Get a booster shot" action5 Due Date: 12/07/2022 occursOn (11/19/22)? false Description: "wear a mask" Assignment 1 consists of three parts, and only the third part is responsible for demonstrating the full capabilities of your program, indicated above. Part 1 requires that you add an abstract occursOn() method to the Action class. As an abstract method, it will have no body, just the header. And because we may wish to have actions for one or more days of the year, occursOn() needs to take three parameters: ints for day, month, and year. Action also needs a one-arg constructor to load the description String. (Ideally, as a superclass, it should have a no-arg constructor as well, although this is not absolutely essential here.) The RegularAction class extends Action, and should include its own one-arg constructor chained to the one-arg superclass constructor in Action. Furthermore, since Action contains an abstract method, all its subclasses will need to override occursOn() with a concrete implementation of that method—including RegularAction. occursOn() determines if there are any tasks to report for this day, depending on the type of Action subclass. For example, if something occurs every day, then the actual date passed doesn't really matter: any day you enter matches the requested date, since that task happens every day. Now create a class called Action Driver to test your new subclass: ❖ Test that RegularAction is a subclass of Action Output a string to indicate the type of test-"RegularAction is just a subclass of Action: "followed by the java reflection code needed to compare RegularAction's superclass with the Action class itself. The expected output is 'true'. So after you've compared RegularAction's superclass with the Action class itself (using '=='), output a line to remind the user that the expected output is true. RegularAction is just a subclass of Action: true Expected: true 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. Additional information slides (PDF) to provide insight into your tasks and the requirements A sample output to guide your solution Grading rubrics to show the possible marks. 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. 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. Additional information slides (PDF) to provide insight into your tasks and the requirements A sample output to guide your solution Grading rubrics to show the possible marks. 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. Since the field(s) used by RegularAction is inherited from its superclass, test that RegularAction has no declared fields of its own. Again, output a String that indicates the test for extra fields in RegularAction, run the appropriate java reflection test, and indicate the expected result. RegularAction activities have no extra fields:true Expected: true ❖ Instantiate a new RegularAction constructor and load it with the message indicated in the sample output. Having loaded an item, you should now be able to output it's description using the object's toString() method. Then output the result of occursOn() and the expected output. Looking at regular actions: Wash your hands Expected: Wash your hands true Expected: true Since the field(s) used by RegularAction is inherited from its superclass, test that RegularAction has no declared fields of its own. Again, output a String that indicates the test for extra fields in RegularAction, run the appropriate java reflection test, and indicate the expected result. RegularAction activities have no extra fields:true Expected: true ❖ Instantiate a new RegularAction constructor and load it with the message indicated in the sample output. Having loaded an item, you should now be able to output it's description using the object's toString() method. Then output the result of occursOn() and the expected output. Looking at regular actions: Wash your hands Expected: Wash your hands true Expected: true In Part 2 you add two more subclasses, OccasionalAction and RareAction, for items that occur on the same day each month, and only once every year, respectively. Again, the shell of these two class is provided for you, and you must override the occursOn() method so that it returns true or false if the new subclass object's day, month, and year meet the requirement specified for that class. Again, these two new classes should have appropriate constructors and overridden concrete implementations of occursOn(), which returns an appropriate boolean value depending on the requirements of the subclass. Create a new test class, Action Driver2, that includes tests for the following: Test that both test classes have the same superclass, Action ❖ Test the number of fields for each subclass. For the OccasionalAction class, only the day of the month is required for a comparison. For the RareAction class, the day and month are required, hence its constructor would set three fields. ❖ Again, instantiate new instances of both subclasses, load a description, and test the occursOn() method in each. In Part 2 you add two more subclasses, OccasionalAction and RareAction, for items that occur on the same day each month, and only once every year, respectively. Again, the shell of these two class is provided for you, and you must override the occursOn() method so that it returns true or false if the new subclass object's day, month, and year meet the requirement specified for that class. Again, these two new classes should have appropriate constructors and overridden concrete implementations of occursOn(), which returns an appropriate boolean value depending on the requirements of the subclass. Create a new test class, Action Driver2, that includes tests for the following: Test that both test classes have the same superclass, Action ❖ Test the number of fields for each subclass. For the OccasionalAction class, only the day of the month is required for a comparison. For the RareAction class, the day and month are required, hence its constructor would set three fields. ❖ Again, instantiate new instances of both subclasses, load a description, and test the occursOn() method in each. In Part 3 you'll instantiate different Action objects, load them into an array, and perform the tests indicated by the sample output-as described in the first slide. Load an array of Action objects of various types, i.e. Regular, Occasional, and Rare. Create various different descriptions of the tasks to be performed. Instantiate a new Scanner, prompt the user to enter a date as three ints corresponding to year, month, day (clearly indicating the order in which these values are entered) ❖ Loop through the array of Action objects, test each object's occursOn() method against the three int's just entered by the user, and then, whenever the method returns true, print that object's toString() method, displaying the task stored in the object's description field. In Part 3 you'll instantiate different Action objects, load them into an array, and perform the tests indicated by the sample output-as described in the first slide. Load an array of Action objects of various types, i.e. Regular, Occasional, and Rare. Create various different descriptions of the tasks to be performed. Instantiate a new Scanner, prompt the user to enter a date as three ints corresponding to year, month, day (clearly indicating the order in which these values are entered) ❖ Loop through the array of Action objects, test each object's occursOn() method against the three int's just entered by the user, and then, whenever the method returns true, print that object's toString() method, displaying the task stored in the object's description field. HOW DO I SUBMIT MY ASSIGNMENT? 1. You must submit your solutions on Brightspace or before the due date. 2. Submit all your solutions through ACTIVITIES >> ASSIGNMENTS >> ASSIGNMENT 1 to Section 300. 3. If your Lab section professor provides an alternative submission information to a designated submission portal, then use that portal which your Professor will create for this assignment. 4. Name your submission using the convention: FirstName_LastName_SectXXX_Assignment1. 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 that generates UML from code. You can use UML editing tools tools only like draw.io, MS Word, MS VISIO or a similar drawing tool. 2. Inspect the starter-code files provided for you. There are loopholes you are expected to fill. HOW DO I SUBMIT MY ASSIGNMENT? 1. You must submit your solutions on Brightspace or before the due date. 2. Submit all your solutions through ACTIVITIES >> ASSIGNMENTS >> ASSIGNMENT 1 to Section 300. 3. If your Lab section professor provides an alternative submission information to a designated submission portal, then use that portal which your Professor will create for this assignment. 4. Name your submission using the convention: FirstName_LastName_SectXXX_Assignment1. 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 that generates UML from code. You can use UML editing tools tools only like draw.io, MS Word, MS VISIO or a similar drawing tool. 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 due 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. 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 due 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. PART 2 In this part of the assignment, you are required to: 1. Include two more subclasses of the Superclass namely, OccasionalAction and RareAction. OccasionalAction shows actions that are conducted once each month, while RareAction depicts actions that take place only once on a specified day of the year. 2. Complete the starter-code provided for you for the two classes OccasionalAction.java and RareAction.java. Hint: Be guided by observing the sample output provided. 3. Your code must check if the action is carried out on that date. For example, if dealing with an OccasionalAction that happens once a month, your code must ensure that the day of the month matches. 4. Write an Action Driver2 class that contains the main method to run this second part of your code. In writing the class named ActionDriver 2.java carefully follow the pattern of the output that has been provided. Instantiate required action objects that suit both the OccasionalAction and RareAction subclasses. PART 3 In this part of the assignment, you are required to: 1. Create a new class called AllAction Test.java with a main method to demonstrate your work. 2. In this class, create and fill an array of Action objects with different types of actions permitted by Ontario Public Health for the COVID-19 protocol including actions that should occur everyday, actions that occur once a month, and actions designated to occur only on a certain date in a year. 3. Implement your code (entire classes) such that the users can input a date and retrieve an output of all actions that would happen on that date. PART 2 In this part of the assignment, you are required to: 1. Include two more subclasses of the Superclass namely, OccasionalAction and RareAction. OccasionalAction shows actions that are conducted once each month, while RareAction depicts actions that take place only once on a specified day of the year. 2. Complete the starter-code provided for you for the two classes OccasionalAction.java and RareAction.java. Hint: Be guided by observing the sample output provided. 3. Your code must check if the action is carried out on that date. For example, if dealing with an OccasionalAction that happens once a month, your code must ensure that the day of the month matches. 4. Write an Action Driver2 class that contains the main method to run this second part of your code. In writing the class named ActionDriver 2.java carefully follow the pattern of the output that has been provided. Instantiate required action objects that suit both the OccasionalAction and RareAction subclasses. PART 3 In this part of the assignment, you are required to: 1. Create a new class called AllAction Test.java with a main method to demonstrate your work. 2. In this class, create and fill an array of Action objects with different types of actions permitted by Ontario Public Health for the COVID-19 protocol including actions that should occur everyday, actions that occur once a month, and actions designated to occur only on a certain date in a year. 3. Implement your code (entire classes) such that the users can input a date and retrieve an output of all actions that would happen on that date. FIND BELOW THE SAMPLE OUTPUT FOR ASSIGNMENT 1: PART 1 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 Occasional Action is subclass of Action: true Expected: true RareAction is subclass of Action: true Expected: true Occasional Action have no extra fields:true Expected: true RareAction have no extra fields:true Expected: true FIND BELOW THE SAMPLE OUTPUT FOR ASSIGNMENT 1: PART 1 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 Occasional Action is subclass of Action: true Expected: true RareAction is subclass of Action: true Expected: true Occasional Action 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 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 Assignment 1, you will instantiate various subclasses of the Action class, and store each instance in an array. In Part 3 of the assignment you'll search the array to see if the date of each Action object matches the date requested by the user, i.e. which action task is 'occursOn' that particular date. Whenever it is, that object's description is printed out using its toString() method. Action[] actions action1: regular Due Date: today action1 Input date: 11/19/22 occursOn (11/19/22)? true "wash your hands" action2: occasional action2 occursOn (11/19/22)? false Due Date: anymonth/03/anyyear action3: occasional occursOn (11/19/22)? true action3 Due Date: anymonth/19/anyyear "Take a PCR test" action4: occasional occursOn (11/19/22)? true action4 Due Date: today action5: rare "Get a booster shot" action5 Due Date: 12/07/2022 occursOn (11/19/22)? false Description: "wear a mask" In Assignment 1, you will instantiate various subclasses of the Action class, and store each instance in an array. In Part 3 of the assignment you'll search the array to see if the date of each Action object matches the date requested by the user, i.e. which action task is 'occursOn' that particular date. Whenever it is, that object's description is printed out using its toString() method. Action[] actions action1: regular Due Date: today action1 Input date: 11/19/22 occursOn (11/19/22)? true "wash your hands" action2: occasional action2 occursOn (11/19/22)? false Due Date: anymonth/03/anyyear action3: occasional occursOn (11/19/22)? true action3 Due Date: anymonth/19/anyyear "Take a PCR test" action4: occasional occursOn (11/19/22)? true action4 Due Date: today action5: rare "Get a booster shot" action5 Due Date: 12/07/2022 occursOn (11/19/22)? false Description: "wear a mask" Assignment 1 consists of three parts, and only the third part is responsible for demonstrating the full capabilities of your program, indicated above. Part 1 requires that you add an abstract occursOn() method to the Action class. As an abstract method, it will have no body, just the header. And because we may wish to have actions for one or more days of the year, occursOn() needs to take three parameters: ints for day, month, and year. Action also needs a one-arg constructor to load the description String. (Ideally, as a superclass, it should have a no-arg constructor as well, although this is not absolutely essential here.) The RegularAction class extends Action, and should include its own one-arg constructor chained to the one-arg superclass constructor in Action. Furthermore, since Action contains an abstract method, all its subclasses will need to override occursOn() with a concrete implementation of that method—including RegularAction. occursOn() determines if there are any tasks to report for this day, depending on the type of Action subclass. For example, if something occurs every day, then the actual date passed doesn't really matter: any day you enter matches the requested date, since that task happens every day. Assignment 1 consists of three parts, and only the third part is responsible for demonstrating the full capabilities of your program, indicated above. Part 1 requires that you add an abstract occursOn() method to the Action class. As an abstract method, it will have no body, just the header. And because we may wish to have actions for one or more days of the year, occursOn() needs to take three parameters: ints for day, month, and year. Action also needs a one-arg constructor to load the description String. (Ideally, as a superclass, it should have a no-arg constructor as well, although this is not absolutely essential here.) The RegularAction class extends Action, and should include its own one-arg constructor chained to the one-arg superclass constructor in Action. Furthermore, since Action contains an abstract method, all its subclasses will need to override occursOn() with a concrete implementation of that method—including RegularAction. occursOn() determines if there are any tasks to report for this day, depending on the type of Action subclass. For example, if something occurs every day, then the actual date passed doesn't really matter: any day you enter matches the requested date, since that task happens every day. Now create a class called Action Driver to test your new subclass: ❖ Test that RegularAction is a subclass of Action Output a string to indicate the type of test-"RegularAction is just a subclass of Action: "followed by the java reflection code needed to compare RegularAction's superclass with the Action class itself. The expected output is 'true'. So after you've compared RegularAction's superclass with the Action class itself (using '=='), output a line to remind the user that the expected output is true. RegularAction is just a subclass of Action: true Expected: true Now create a class called Action Driver to test your new subclass: ❖ Test that RegularAction is a subclass of Action Output a string to indicate the type of test-"RegularAction is just a subclass of Action: "followed by the java reflection code needed to compare RegularAction's superclass with the Action class itself. The expected output is 'true'. So after you've compared RegularAction's superclass with the Action class itself (using '=='), output a line to remind the user that the expected output is true. RegularAction is just a subclass of Action: true Expected: true
Expert Answer:
Answer rating: 100% (QA)
Based on the problem statement provided you need to create a Java application that models actions to be taken by schools and businesses according to a specified routine including regular occasional an... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Which of the following bacterial diseases can be cured using antibiotics? Option: 1) Malaria 2) Typhoid 3) AIDS 4) Dengue
-
On February 2, 2016, Alexandra purchases a personal computer for her home. The computer cost $2,800. Alexandra uses the computer 80 percent of the time in her accounting business, and the remaining...
-
In Exercises 25 through 32, find the composite function f(g(x)). f(u) = 3u 2 + 2u 6, g(x) = x + 2
-
Reconsider the data from Problem 51. What is the capital recovery cost of Alternative 3 for a 6-year life? Data from problem 51 Alternatives 1, 2, and 3 have lives of 3, 4, and 6 years, respectively....
-
The accounts receivable balance for Renue Spa at December 31, 2015, was $61,000. Also on that date, the balance in the Allowance for Doubtful Accounts was $3,750. During 2016, $2,100 of accounts...
-
Three friends, A, B, and C, start a business with investments in the ratio of 4:3:5, respectively. A invested $5,000, and all three of them agree to share profits in the ratio of their investments....
-
A cylindrical wire of radius 2.0 mm carries a current of 2.5 A. The potential difference between points on the wire that are 46m apart is 3.7 V. a) what is the electric field in the wire? b) What is...
-
2. Assume the securities are all issued by the same firm. From the investor's standpoint, rank the following securities in order of increasing risk (the number of the least risky security is placed...
-
The following trial balance was taken from the books of Venus Corporation at December 31, 2020: Account Cash..... Accounts Receivable.. Prepaid Rent Note Receivable.... Merchandise Inventory....
-
Scale up was carried out using constant power consumption per unit volume. The impeller diameter of the small reactor (Dsmall) is 80 mm. Calculate the impeller speed of the small reactor ( Nsmall)...
-
How does the absence or presence of emotional of intelligence affect interpersonal communication? Can and should emotional intelligence be taught and by whom? We as people could work to better our...
-
How does being sexually assaulted positively changed your life? And how did you use that experience as a learning experience or simply what have you learned when you experienced sexually assaulted?
-
Liquidity ratios are a class of financial metrics used to determine a debtor's ability to pay off current debt obligations without raising external capital. Select any non financial firm from...
-
What are some of the various ways to implement an awareness program?
-
Define and explain the use of the following terms. Provide examples of when each would be used: a. Amortization b. depreciation c. Depletion
-
To expand its product line, Dorchester Manufacturing Ltd. (Dorchester) purchased 100 percent of the outstanding shares of Hardisty Inc. (Hardisty). Dorchester paid $3,500,000 cash for the shares. The...
-
For each of the following situations use the IFRS revenue recognition criteria to determine when revenue should be recognized. Explain your reasoning. a. A person buys a chocolate donut and a large...
-
Find the dynamic system response for the rotational mechanical system shown below. There is a constant input angular speed, \(\omega(t)=\beta\), and zero initial angular speed, \(\omega_{1}(0)=0\)...
-
Consider a first-order system with no input such that the input-output differential equation is given by \[\dot{y}+3 y=0 \text {. }\] Find its system response.
-
A dynamic system is described by the following State-Variable Matrix model such that: \(\dot{\mathbf{x}}=\mathbf{A x}\) and \(\mathbf{y}=\mathbf{C x}\), where (a) Obtain the State-Transition Matrix...
Study smarter with the SolutionInn App