Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A software used by engineers uses a CheckupRecord class to record equipment checkup information. For simplicity, only equipment id, last checkup date and relevant methods

A software used by engineers uses a CheckupRecord class to record equipment checkup information. For simplicity, only equipment id, last checkup date and relevant methods of this class are shown here:

// A class for equipment checkup record public class CheckupRecord { private String eId; // equipment ID private int monthOfLastCheckup; // 1 - 12 private int yearOfLastCheckup; // a valid year // additional data/methods not shown public String getEId() { return eId; } public int getMonthOfLastCheckup() { return monthOfLastCheckup; } public int getYearOfLastCheckup() { return yearOfLastCheckup; } } // end class CheckupRecord

Complete a method to process a list of CheckupRecord. This method takes three parameters, an ArrayList, a current year and a current month. The method should return a list of equipment (just their IDs) whose last checkup date is one year or older from the specified current date. Assume curYear and curMonth represent a valid date.

public static ArrayList getEquipmentsToBeChecked( ArrayList records, int curYear, int curMonth) { // ADD CODE }

For example, given an ArrayList with three records (shown in format of ID-year-month):

"104"2019-7 "114"2018-5 "124"2019-9

and different curMonth and curYear values, the method should work like this:

Example curYear and curMonth

return note
2020, 7
{"104", "114"}
"104"-2019-7: exactly one year ago; "114"-2018-5: more than one year ago; "124"-2019-9: not one year yet.
2019, 12
{"114"}
"104"-2019-7: not one year yet; "114"-2018-5: more than one year ago; "124"-2019-9: not one year yet.
2019, 8
{"114"}
Dont worry about why current date is older than some last checkup dates. You just need to compare the dates to see if last checkup date is one year ago or older.

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_2

Step: 3

blur-text-image_3

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

How do members envision the ideal team?

Answered: 1 week ago

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago