Supply Spaceships of Different Designs and Capabilities - IT Assessment Answer

Download Solution Order New Solution

IT Assessment Task

Question 1:

  1. Create a Java class called HolidayHome to represent a short-term holiday lease such as a holiday house or apartment for a holiday home rental business.

 Include brief comments in your class definition as necessary.

The class should have:

  • four fields that capture the holiday home’s address, its rental price per month, the number of bedrooms, and whether the holiday home has Wi-Fi.
  • a constructor that initialises the fields.
  • a method for setting the number of bedrooms field; it should check for a reasonable input value.
  1. Create a Java class, ‘Rentals’, for managing a group of holiday homes that are available for rental. This class should have:
  • one field to store all the currently available holiday houses.
  • a constructor that initialises this field.
  • a method that takes a holiday house as an argument and removes it from the list.
  • a method that takes two holiday houses as arguments and returns the holiday house with the lowest monthly rent.
  1. Create a method, HolidaySeason, that takes two integers as parameters representing a month and day and that returns a String indicating the season for that holiday month and day. Assume that months are specified as an integer between 1 and 12 (1 for January, 2 for February, and so on) and that the day of the month is a number between 1 and 31. You should check that the inputs are within these bounds, but you are not required to check for invalid month, day combinations such as month=2 and day=30. Seasons are defined as: Spring (March, April, May), Summer (June, July, August), Autumn (September, October, November) and Winter (December, January, February).
  • Create five test cases to check the correctness of an implementation of this method.
  • Write Java code to implement the HolidaySeason method.

Question 2:

Supply spaceships of different designs and capabilities have been developed to support a human colony on the moon. The ships embark continually from a spaceport in low earth orbit to the moon. On arrival the ships undock, unload their cargo and undergo refuelling and maintenance in ‘The RF Centre’ (RF) before embarking on the return journey. The bulk of the time at spaceport is spent in RF but only a single spaceship can be accommodated in RF at any one time.

Five competing companies have manufactured distinct ships to service the colony - each ship travels at different speeds, has a different payload capacity and requires differing periods in RF (relative to the fastest ship):

    • Ship 1, capacity 3000Kg, is the fastest ship spending 1 (minimum) to 2 days (maximum) in a one way trip with 2 to 4 days in maintenance (RF centre) per return trip.
    • Ship 2, capacity 6000Kg, spends twice as long travelling but spends the same amount of time in RF.
    • Ship 3, capacity 14000Kg, takes three times as long travelling as the fastest ship and spends two times the amount of time in RF.
    • Ship 4, capacity 20000Kg, takes four times as long travelling as the fastest ship and spends three times the amount of time in maintenance.
    • Ship 5, capacity 40000Kg, takes five times as long travelling as the fastest ship and spends four times the amount of time in maintenance.

Follow the subsections below (together with your own model) to write a multithreaded Java application to simulate the performance of the ships in competition with each other over 3 years. Include screenshots of the output of your program in your answer and paste the Java code of your final solution in an appendix to the document.

  1.  Create a Ship class. The constructor for the ship class should accept a reference to the RF centre object, an identifier string for the ship’s name (“ShipType 1”, for example) and three numbers identifying the unique characteristics of each of the ships; the maximum payload in KG, the maximum days of a single journey to travel to the colony and the maximum days in the RF centre.

The ship should have members that store a count of the total number of trips, total time spent travelling and in maintenance [RF center].

Each ship must have a run() method which advances the time elapsed “travelling” by 1 day of simulation time for each 10ms of actual time. A random number generator should be used to calculate the duration of each trip within the limits specified by the ship type. When the end of the competition has been reached (3 years), a toString method should display the total number of trips, count of days spent travelling and days spent in the RF centre. The total cargo weight delivered should also be displayed.

Display messages in the terminal stating that the simulation has started, notifying the user if an RF session is taking place and display each agent’s toString method at the end of the simulation. Calculate and display the total payload transported

  1. Create an RF_Centre class. It should have a method to “refuel and maintain” a space ship and return the actual RF duration in days. Ensure only one ship can access the RF Centre at any one time.
  2. Create a SpaceshipCompetition class that has a main method that creates and starts the threads.
  3. You want to ensure that all space ships depart at the same time when the competition starts. Write a new class called “Competition” that has methods to:
  • Get Ready for Competition Start – makes all spaceships wait for the Competition to start.
  • Start the Competition – notifies all ships to start their journey.

Modify the CompetitionMain and Ship classes accordingly.

 

This IT Assessment has been solved by our IT experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.