A software used by engineers uses a CheckupRecord class to record equipment checkup information. For simplicity, only
Fantastic news! We've Found the answer you've been seeking!
Question:
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()
Related Book For
Elementary Principles of Chemical Processes
ISBN: 978-0471720638
3rd Edition
Authors: Richard M. Felder, Ronald W. Rousseau
Posted Date: