Room and Fan Class Composition - Java Quiz Question


Define the Room and Fan classes such that the following program compiles and runs without errors.



class RoomAndFan
{
    public static void main(String s[])
    {
        Room hall = new Room();
        hall.width = 14;
        hall.length = 20;
        hall.name = "First Hall";
        
        hall.fan = new Fan();
        hall.fan.color = "Brown";
        hall.fan.speed = 1200.0;
        hall.fan.numberOfWings = 3;
        
        System.out.println(hall.name + " has a fan with " + hall.fan.numberOfWings + " wings and its speed is " + hall.fan.speed + " rpm. Its color is " + hall.fan.color +".");

    }



}
class Room
{
}

class Fan
{
}