CSCI 111, Outlab 2

Outlab 2: Navy Fuel Consumption

Due: Tuesday 12 July at 10 pm

Purpose

Create a system consisting of multiple interacting classes.

Partners

This is an individual assignment, though collaboration (not solution sharing) is allowed.

Problem Statement

You have been commissioned by the US Navy to develop a system for tracking the amount of fuel consumed by fleets of ships. Each ship has a name (ex: "USS Montana"), fuel capacity (the maximum amount of fuel the ship can carry), and amount of fuel currently onboard. In this problem, fuel is measured in "units" and the capacity of each ship is an integer number (ex: The carrier's capacity is 125 fuel units). Each fleet has exactly four ships in it. When a fleet is deployed, each ship in the fleet is deployed. When a ship is deployed, it consumes half of the fuel it has onboard. When a fleet is refueled, each ship in the fleet is refueled. When a ship is refueled, it is totally filled up (its onboard amount equals its capacity).

Tasks

Hints

  1. Think about what variables you need in Ship. I did not tell you what all the variables you may need are.
  2. Create Ship first without worrying about tracking fuel consumed. Get the program working just with worrying about deploying and refueling.
  3. You can test Ship without Fleet or Driver by creating instances of Ship and calling the methods you wrote on it.
  4. Test and print out intermediate phases of your design (ex: when I deploy a fleet, does the amount of fuel onboard each ship successfully decrease by half?)
  5. Finally, test your product. I predict that numerous people will turn in incorrect solutions without even checking to see the output is correct. (What SHOULD the amount of fuel consumed be?),e.g.output

Submission

By Tuesday 12 July at 10:00 pm, submit the files Fleet.java and Ship.java into the appropriate D2L dropbox folder. DO NOT SUBMIT Fleet.class or Ship.class!

Grading - 20 points

5 points lost automatically if your submissions do not compile with the original Driver file.