Nested ifs

The Java Beach Resort has two types of rooms: Ocean View and Street Side. The rooms can accommodate either two or 4 people. The rates are higher in summer than in the winter. Write an application that can determine the cost of a room. Room charges are in the given table.

  Ocean Street
  2 people 4 people 2 people 4 people
Summer $250 $370 $200 $325
Winter $175 $315 $150 $210

Write a class Room. It has a constructor that takes three parameters:

It also has a method:

The cost is based on the table above. One person costs the same as two people and three people cost the same as 4 people. For more than 4 people, the charge is $200 per person for every room. If view is a String other than "Ocean" or "Street", charge the rate for "Ocean". If the season is anything other than "Summer" or "Winter", charge the rate for "Summer." Use nested if statements.

A RoomTester is included for your convenience.

public class RoomTester
{
   public static void main(String[]args)
   {
       final String SUMMER_SEASON = new String("Summer");
       final String WINTER_SEASON = new String("Winter");
       final String BAD_SEASON = new String("Fall");
       final String OCEAN_VIEW = new String("Ocean");
       final String STREET_VIEW = new String("Street");
       
       Room r = new Room(OCEAN_VIEW, BAD_SEASON, 1);
       System.out.println(r.getCost());
       System.out.println("Expected: 250.0");
       
       r = new Room(OCEAN_VIEW, WINTER_SEASON, 3);
       System.out.println(r.getCost());
       System.out.println("Expected: 315.0");
       
       r = new Room(STREET_VIEW, WINTER_SEASON, 2);
       System.out.println(r.getCost());
       System.out.println("Expected: 150.0");

       r = new Room(STREET_VIEW, WINTER_SEASON, 4);
       System.out.println(r.getCost());
       System.out.println("Expected: 210.0");

       r = new Room(STREET_VIEW, WINTER_SEASON, 5);
       System.out.println(r.getCost());
       System.out.println("Expected: 1000.0");    
       
    }
}