Methods

Delete method

Managerpublic void delRental (int n){ for (int i = 0; i< cnt; i++) 'Array name'[i] = 'Array name' [i+1]; cnt—;}UISystem.out.print("Remove which rental item?");int n = Integer.parseInt(inKb.readLine());rm.delRental(n-1);System.out.println("--- AFTER ---");System.out.println(rm);

Date codes

isBefore()isAfter()plusDays(1)LocaleDate.now()

How to find tomorrows date

declare now()Now's variable.plusDays(1);

FILE Writer

MANAGERpublic void commit(String filename) throws Exception { FileWriter outF = new FileWriter(new File(filename)); for (int i = 0; i < cnt; i++) outF.write(rvArr[i] + "\n"); outF.close(); }UI System.out.println("Enter a name for file");String filename = inKb.readLine() + ".txt"; rm.commit(filename);

Comparing child and parent class

public String CarNames (){ String s = ""; for (int i = 0; i < cnt; i++) { if (rvArr[i] instanceof BigVehicle) s += "SPECIAL " + rvArr[i] + "\n"; else s += rvArr[i].getName() + "\n"; } return s; }UI sout - rm.CarNames()

...

String good = "";String wrong = "";int chk = 0; for (int i = 0; i < cnt; i++) { if (rvArr[i].getCheckIn().isAfter(rvArr[i].getCheckOut())) { wrong += "WRONG ORDER CHECK IN: " + rvArr[i].getCheckIn() + "cannot be after checkout: " + rvArr[i].getCheckOut(); chk++; } else { good += "CHECK IN AND CHECK OUT ARE ALL GOOD"; } } if (chk >= 1) return wrong; else return good;