CS46A Fall 18

6A

Santa Cruz Inn rents rooms. The price per night varies depending on the season of the year (low and high) and the number of people in the room. Below is a table of prices. Add $50.50 for every person over 4.

  2 people 4 people
high season $250 $375
low season $200 $300

Complete the class SantaCruzInnRoom which models a room at this motel.

It will have a constructor that takes the season and the number of people in that order

It has 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 a flat $50.50 per extra person in either season. Use nested if statements. Only use 1 return statement. Use the constant provided.

Provide Javadoc

For the draft, provide the constructor and the implementation of setGuests method. Code getCost as a stub. The instance varibles are provided along with the getSeason and getGuests methods

6A draft:
6A final:

6B

Create a class LoopsAndMore. It has several methods that use loops. There are no instance variables. These problems aren't especially useful, but they will let you practice writing loops.

No Javadoc required

For the draft, implement sumEveryThird to find the sum when the limit is 36. Do not use a loop for this. Just add the values in the code 
 (return 3 + 6 + ...).  Do not just return 153.
But think about how you determine which numbers to include and when to stop. You will remove this code in the final and use a loop instead. Do not just print the literal answer

6B draft:
6B final:

6C

Write a class Text which has a constructor that takes a String of text. Implement the following methods.

Provide Javadoc

For the draft, provide the instance variable, constructor, getText() and getACount() methods along with the necessary Javadoc

6C draft:
6C final: