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;
   }
}

You forgot to post the full text of the error messages.

sorry it says

Bathroom.java:15: cannot find symbol
symbol  : constructor Room()
location: class Room
    {   
    ^
Bathroom.java:25: cannot find symbol
symbol  : constructor Room()
location: class Room
   {
   ^
2 errors

Your posted code doesn't match the error messages you posted.
I do NOT see any call to super() in your code.

If you were to add the call to super() you need to add a constructor to the "super" class (Room) that has that same number of parameters as in the super() call ( there are none).

ok you lost me with the super() so maybe I need to see if I can figure out about that. Thanks for pointing me in the right direction.

I think that someone that was trying to help me tried something with super so when I tried posting the errors they were not the ones I had so it should be

Bathroom.java:15: cannot find symbol
symbol  : constructor Room()
location: class Room
    {   
    ^
Bathroom.java:25: cannot find symbol
symbol  : constructor Room()
location: class Room
   {
   ^
2 errors

Your error messages do not match the code you posted.

Do you know what a class constructor is?
Does the Room class have a constructor with no arguments?

In terms of Java language, Java requires that when you construct a new instance the constructors for the class and all its superclasses get run, superclasses first.
To achieve that either
1. You start your constructor with a call to a superclass constructor
or
2. The compiler inserts one for you at the start of your constructor. The call that the compiler inserts is a call to the default (no arguments) constructor of the superclass, ie super();

In your code you don't call a superclass constructor, so Java inserts a super();
But the superclass doesn't have a default (no args) constructor. so that's the error message you get.

In terms of design your problem is that in your subclass you think about initialising the extra fields for the subclass, but you forgot that you inherit from the Room class a bunch of variables that still need to be initialised.

Think on that for a while. If you still can't see a way to solve it come back here for some more hints.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.