• Cont a ins the m a in(String[] a rgs) method. • Expects the folder p a th a s a comm a nd-line a rgument. • C a lling object: f ileH a ndler.re a dFileN a mes(folderP a th) to get f ile n a mes. • C a lling object: bo a rdM a n a ger.cre a teBo a rd( f ileN a mes) to gener a te the bo a rd l a yout. 6
folder. • Cont a ins a method re a dFileN a mes(String folderP a th) th a t: (1) Re a ds a ll non-directory f ile n a mes in the speci f ied folder; (2) Returns a n a rr a y of strings with the n a mes. 7
rd a nd its l a yout. • H a s a n Arr a yList<Squ a re> to store squ a res. • The cre a teBo a rd(String[] f ileN a mes) method: (1) Cre a tes one Squ a re per f ile n a me; (2) C a lcul a tes the optim a l number of columns a nd rows to f it a ll squ a res in a l a yout close to a squ a re (e.g., 5×4 for 18 f iles, not 6×3). 8
bo a rd. • Stores: (1) The f ile n a me; (2) Position on the bo a rd (column a nd row); (3) A color, a ssign a color to e a ch f ile a ccording with some condition such a s size, d a te of cre a tion, or just r a ndom (for now). • H a s a method toString a s follows: @Override public String toString() { return String.format("(%d,%d) %s [%s]", row, col, fileName, color); } 9
[email protected] Summer 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.