?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Boat Storage Company Class Design

APCSA-JAMFVB

Consider the following requirement.

A company that owns boat storage operations at various lake locations needs to mimic their basic business model with Java classes. They are in the business of renting storage space for different size boats and maintain the inventory of each of the boats’ contents.

They are required by law to keep track of the boat’s value which includes a description and value of each major item on the boat. A storage bin can contain only one boat and all boats are stored in a storage bin.

Which of the following options would be an acceptable design for their business?

I.


        public class Boat 
        {
              private String owner;
              private double boatValue;
              private int inventoryQuantity;
              private double inventoryValue;
              // other data and methods not shown
        }

        public class StorageBin 
        {
              private int binNumber;
              private Boat boat;
              // other data and methods not shown
        }

        public interface StorageLocation 
        {
              private ArrayList<StorageBin> bins;
              private String locationID;
              private String description;
              private String streetAddress;
              // other data and methods not shown
        }

        public class Company  
        {
              private String companyName;
              private ArrayList<StorageLocation> locations;
              // other data and methods not shown
        }

II.


        public class BoatInventory 
        {
              private String description;
              private int quantity;
              private double value;
              // other data and methods not shown
        }

        public class StorageBin 
        {
              private int binNumber;
              private String boatDescription;
              private String boatOwner;
              private double boatValue;
              private ArrayList<BoatInventory> inventory;
              // other data and methods not shown
        }

        public class StorageLocation 
        {
              private ArrayList<StorageBin> bins;
              private String locationID;
              private String description;
              private String streetAddress;
              // other data and methods not shown
        }

        public class Company  
        {
              private String companyName;
              private ArrayList<StorageLocation> locations;
              // other data and methods not shown
        }

III.


        public class BoatInventory 
        {
              private String description;
              private int quantity;
              private double value;
              // other data and methods not shown
        }

        public class Boat 
        {
              private String owner;
              private double value;
              private ArrayList<BoatInventory> inventory;
              // other data and methods not shown
        }

        public class StorageBin 
        {
              private int binNumber;
              private Boat boat;
              // other data and methods not shown
        }

        public class StorageLocation 
        {
              private ArrayList<StorageBin> bins;
              private String locationID;
              private String description;
              private String streetAddress;
              // other data and methods not shown
        }

        public class Company  
        {
              private String companyName;
              private ArrayList<StorageLocation> locations;
              // other data and methods not shown
        }
A

I only.

B

II only.

C

II and III only.

D

I and II only.

E

I, II, and III.