attached below1. No cost checking is applied on the passed fare to verify that it’s enough for the given journey. Eg..
public room(int fare, String number)
this.fare = fare;
this.number = number;
This implies that negative numbers may be given as fare.
This can be solved by adding a test for amount of fare should be set to a minimum positive number. For
this case I use $500.
2. setupShip() is public in UBCruises. This makes it vulnerable to null pointer exception in case the class
is not initialized.
Make setupShip() private in UBCruises class.
3. Most fields are set to public visibility. This may cause invalid memory references during program
execution due to access of variables before assignment. E.g.
publicint fare;
publicString number;
publicBoolean booked = false;
This can be solved by creating getter and setter methods for this variable and making
these variables private in their respective classes.
4. Ship getDeck() does not check whether a cabin exists before returning
return (ArrayList)cabins[deckName];
This can be solved by checking whether there are cabins in the list. If the list is empty, return null. Throw
runtime exception if no such deck is found.

Purchase answer to see full

Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.