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 recordpublic 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 

 

Reference:

class java.util.ArrayListvoid add(int index, E element)boolean add(E element)E get(int index)boolean isEmpty()int size()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

getEquipmentsToBeChecked method by iterating through the list of CheckupRecord objects checking if each records last checkup date is one year or older ... 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

Elementary Principles of Chemical Processes

Authors: Richard M. Felder, Ronald W. Rousseau

3rd Edition

978-0471687573, 9788126515820, 978-0-471-4152, 0471720631, 047168757X, 8126515821, 978-0471720638

More Books

Students also viewed these Programming questions

Question

Can you create a meme for me using a communication concept?

Answered: 1 week ago