6A

The Java Ski Resort has two types of rooms: Mountain View and Street Side. The rooms can accommodate either two or 4 people. The rates are higher in winter than in the summer. Room charges are in the given table.

  Mountain Street
  2 people 4 people 2 people 4 people
Winter $250.00 $370.00 $200.00 $325.00
Summer $175.00 $260.00 $150.00 $200.00

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

It also has a methods:

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 $100 per each additional person for any room. If view is a String other than "Mountain" or "Street", charge the rate for "Mountain". If the season is anything other than "Summer" or "Winter", charge the rate for "Winter." Use nested if statements.

You may use the litterals 1, 2, 3, and 4, but define and use constants for the room charges.

For the draft, write the javadoc for the constructor and the methods. Implement the constructor and getSeason method. Provide stub for the getCost and setOccupants methods so that your class will compile with the tester.

6A draft:
6A final:

6B

Complete the MyNumber class. The class has a constructor that takes a positive int parameter and has the following methods.

For the draft: For the draft, implement getOddSum as a stub. For largestPowerOfTwo, return -1 if the number is less than 2, return -1. otherwise return 0 for now. Also provide Javadoc for the two methods.

6B draft:
6B final:

6C

Complete the  TextUtil class. The class has a constructor that takes a String parameter and the following methods.

For the draft, implement the getCount. Implement the other two methods as stubs. Write Javadoc for all three methods.

6C draft:
6C final: