Transcribed TextTranscribed Text

Detailed Assignment Description Assignment Aim: Develop a Java Application for the shipping company according to the scenario below. This assessment will test you on the use of arrays, inheritance, and String functions among other concepts. Scenario: You are asked to create a Java application for a maritime transportation company, Aria Logistica. Aria Logistica operates across the English Channel from Calais. The company transports cargo containers and passengers to London, Antwerp and Amsterdam. The company operates a total of two vessels: ● a cargo ship with a capacity of 10 containers and maximum speed of (hypothetical) 7 Mph ● a passenger ferry with a capacity of 35 passengers and maximum speed of (hypothetical) 10 Mph Vessels can only travel to and from a single destination a given distance away (distance and destination are fixed and provided as part of the shipping order). The application should support Aria Logistica to process given number of orders for transporting cargo and passengers. The application should use the given orders to monitor the progress of transportation and vessel movement, as well as to produce a report after the completion of any individual order. It should calculate the time required to complete the order, the number of journeys made, and report on the number of passengers and cargo transported for individual orders. The application provides a visualisation to demonstrate the movement of the ships, loading and unloading of cargo as well as the boarding and disembarking of the passengers. You are not required to implement the part responsible for the visualisation, as it has been provided with the given source Code. Source Code Description: The provided source code compiles, but requires further modifications. The comments used in the source code highlight the sections of the code that require implementation/modification. The required modifications/implementations revolve around: implementing the given method stubs and implementing relevant inheritance hierarchy. The source code also contains a number of classes. Please note that all of the classes have been implemented within a single .java file to enable the submission of your work through a TestDome submission/testing environment. When implementing multiple classes in a single java file, you can only specify one public class. Therefore, do not change the visibility of any of the classes, and please ensure that you continue the development of the application using this single file. The sections of the code that you are required to change are clearly marked with comments. Here is an example of the comment from one of the classes: /** * COMPLETE the method. * Your method should: * calculate the total time needed for the journey to the destination and back. * You should use totalDistanceByCargoShip() first, to ensure you have the distance, * and the maximum speed of the vessel. If necessary, use casting to display the * time as a double, rather than an integer. **/ public double totalTimeForTransportingCargo(Order order){ return 0; //Should return the correct time } Recommended Approach to Developing the Application: 1) Download the given source code. 2) Compile and run the code. You should only see a simple message appearing on the screen: Figure 1: output of unmodified source code 3) Study the existing classes and the existing methods. Use the description of the classes below. 4) Look through the comments that specify which sections of the code will need to be modified and/or implemented. 5) Start by implementing the methods which appear to be the simplest, e.g. getters and setters. For example: checkShipLength() or getter and setter methods for the Order class. You can then move on to more complex methods like totalTimeForTransportingCargo(Order order). Please note, that this is just a recommendation rather than a requirement. Adopt any strategy that works best for you. IMPORTANT: You should only change the sections of the code that you are asked to work on explicitly. For example: do not change access modifiers to the variables from private to public and start using the variables directly, rather than through the getter/setter methods. Most importantly, DO NOT change any existing signatures of the methods. For example, if you are given a method: void load(int numberOfItems, char itemCharacter), do not introduce new parameters or change the return type. Classes and Class diagram: The code contains 6 classes: Ship, CargoShip, FerryShip, Order, ShippingManager and ShipTest. When creating the class hierarchy for the vessels – refer to the class diagram below. A more detailed description of the classes is provided in the following section. Figure 2: Class diagram ShipTest Class: This is a simple class that contains the main() method for running and testing the functionality of the application. It instantiates a set of orders as an array (i.e., Order[] orders) and enables calling the rest of the methods (already implemented or to be implemented by you). Use this class for testing your implementation. ShippingManager Class: ShippingManager is responsible for obtaining orders (i.e., Order[]) and instances of the available vessels (i.e., FerryShip and/or CargoShip) created in the ShipTest class. The class is required for processing the orders and printing out the summary after the completion of individual orders. You will need to edit methods in this class. You may find it easier to implement some of the simpler classes first. Ship Class: As shown in the Figure 2 class diagram, Ship is a superclass for the classes FerryShip and CargoShip. You are responsible for implementing the hierarchy of the three classes correctly. As you can see from the source code, there are a number of methods defined in the Ship class, including move(...), moveBack(...), load(...), unload(...). You are only required to modify the checkShipSpeed(...) and checkShipLength(...) methods. FerryShip Class: FerryShip class is a subclass of the class Ship. This class uses the methods of its superclass, but provides additional information (i.e., passengerChar) to indicate the type of the character used for representing passengers when visualising a vessel with passengers. You will need to edit this class. CargoShip Class: CargoShip class is another subclass of the class Ship and is fully implemented. Order Class: Order class is a simple class that holds data on a single order (i.e. customer name, destination, distance etc.). The order contains variables for storing the number of passengers and containers. Please note, when instantiating an order with cargo only, the number of passengers should be set to 0. You are required to implement most parts of this class, including getter and setter methods for all the instance variables.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class ShippingTest {

public static void main(String[] args){
    //The Manager of the shipping company receives 3 orders
    //The orders are stored in an array
    Order[] orders = {
      new Order("Argos", 10, 0, "London", 10),
      new Order("Seven Seas", 0, 10, "Amsterdam", 15),
      new Order("Amazon", 5, 0, "Anwerp", 20)
    //Creating an instance of a CargoShip                           
    CargoShip aCargoShip = new CargoShip(10, 7);
    //Print the instantiated CargoShip - given the length
    System.out.println("This is the Cargo Ship: " + aCargoShip.getShipRepresentation() );
    //Creating an instance of a FerryShip                           
    FerryShip aFerryShip = new FerryShip(15, 10);
    //Print the instantiated FerryShip - given the length
    //UNCOMMENT the following line, AFTER IMPLEMENTING THE FerryShip Class
    System.out.println("This is the Ferry: " + aFerryShip.getShipRepresentation() );
    //Create an instance of the ShippingManager
    ShippingManager manager = new ShippingManager(orders, aCargoShip, aFerryShip);
    //Call the method for completing the shipment of containers and transfer of passengers.

class ShippingManager{
Order[] orders;
CargoShip aCargoShip;
FerryShip aFerryShip;

public ShippingManager(Order[] orders, CargoShip aCargoShip, FerryShip aFerryShip){
    this.orders = orders;
    this.aCargoShip = aCargoShip;
    this.aFerryShip = aFerryShip;

   * COMPLETE the method.
   * Your method should:
   * - loop through the array of Orders
   * - call transportAllCargo()
   * - call transportAllPassengers()
   * You should check whether there is cargo/passengers to transport with the order
   * It should call printOrderSummary after the TransportAllCargo and TransportAllPassengers
   * have completed for individual orders.
public void completeOrders() {
    //loop through the array of orders
    for (Order order: orders) {
      //if necessary transportAllCargo();
      if (order.getNumberOfCargo() > 0)
       transportAllCargo(order.getNumberOfCargo(), aCargoShip, order.getDistance());
      //if necessary transportAllPassengers();
      if (order.getNumberOfPassengers() > 0)
       transportAllPassengers(order.getNumberOfPassengers(), aFerryShip, order.getDistance());

public void printOrderSummary(Order order){

By purchasing this solution you'll be able to access the following files: and Solution.png.

50% discount

$70.00 $35.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats