/** Room.java - a room needs to keep track of its length and width * Later, in the driver, we will use the area of the room to determine * how much it should cost to tile (or carpet) a floor. * Attributes: length * width * a boolean to tell me if I need tile or not * Operations: finding the area * find cost to tile or carpet this room * return a string representation of a room's information */ public class Room { private int length; private int width; private boolean shouldTile; // It doesn't make much sense to have a default constructor... // so we'll just make an initial-value constructor. public Room (int len, int wid, boolean tile) { length = len; width = wid; shouldTile = tile; } public int findArea() { return length * width; } public double findTileCost(double rate) { if (shouldTile) return rate * findArea(); else return 0.00; } public double findCarpetCost(double rate) { if (shouldTile) return 0.00; else return rate * findArea(); } public String toString() { return "length = " + length + ", width = " + width; } }