Can someone please explain to me why I am getting errors with this?
/**
This class stores data about a room.
*/
public class Room
{
private int walls; // Number of walls
private int windows; // Number of windows
private String ceiling; // Type of ceiling
private String floor; //type of floor
private String color; //color of walls
private String trim; //color of trim
private int doors; // number of doors
public Room(int roomWalls, int roomWindows, int roomDoors, String roomCeiling, String roomFloor, String roomColor, String roomTrim)
{
walls = roomWalls;
windows = roomWindows;
ceiling = roomCeiling;
floor = roomFloor;
color = roomColor;
trim = roomTrim;
doors = roomDoors;
}
public Room(Room object2)
{
walls = object2.walls;
windows = object2.windows;
ceiling = object2.ceiling;
floor = object2.floor;
color = object2.color;
trim = object2.trim;
doors = object2.doors;
}
public void set(int roomWalls, int roomWindows, int roomDoors, String roomCeiling, String roomFloor, String roomColor, String roomTrim)
{
walls = roomWalls;
windows = roomWindows;
ceiling = roomCeiling;
floor = roomFloor;
color = roomColor;
trim = roomTrim;
doors = roomDoors;
}
public String toString()
{
// Create a string representing the object.
String str = "Walls: " + walls +
"\nWindows: " + windows +
"\nCeiling: " + ceiling +
"\nFloor: " + floor +
"\nColor: " + color +
"\nTrim: " + trim +
"\nDoors: " + doors;
// Return the string.
return str;
}
}
Here is the subclass which is having problems compiling:
/**
This class stores data about a bathroom.
*/
public class Bathroom extends Room
{
private String showersType; // Type of shower
private String tubType; // Type pf tub
private String toiletType; // Type of toilet
private String sinkType; // Type of sink
public Bathroom(String tshower, String ttub, String ttoilet, String tsink)
{
showersType = tshower;
tubType = ttub;
toiletType = ttoilet;
sinkType = tsink;
}
public Bathroom(Bathroom object2)
{
showersType = object2.showersType;
tubType = object2.tubType;
toiletType = object2.toiletType;
sinkType = object2.sinkType;
}
public void set(String tshower, String ttub, String ttoilet, String tsink)
{
showersType = tshower;
tubType = ttub;
toiletType = ttoilet;
sinkType = tsink;
}
public String toString()
{
// Create a string representing the object.
String str = "Shower Type: " + showersType +
"\nTub Type: " + tubType +
"\nToilet Type: " + toiletType +
"\nSink Type: " + sinkType;
// Return the string.
return str;
}
}