It is the year 2030, the MarsX Space Vehicles Company is in the process of designing its X-2 single use Space Transportation Systems (STS).  You have been tasked with creating a class to model a single STS.

Design a class named STS (Space Transportation System) that contains:
1.    A private int data field named STSId for the STS registration ID.
2.    A private Date data field named dateCreated that stores the date when the STS was created.
3.    A private double data field named emptyMass in pounds (default to 613,100) which represents the mass of the STS before fueling.
4.    A private double data field named fuelMass in pounds (default to 3,785,000) which represents the mass of the fuel needed by the STS.
5.    A private double data field named payloadMass in pounds (default to 0) which represents the mass of the STS payload.
6.    A private double data field named totalMass which represents the mass of the STS after it has been assembled in the launchpad fully fueled (emptyMass + fuelMass + payloadMass).
7.    A private String data field named manufacturer that stores the name of the company that built the STS (default MarsX). Assume all STSs have the same manufacturer.
8.    A private int data field flightTime in seconds (default to 0).
9.    A no-arg constructor that creates a default STS and initializes the STSId with a 5 digit random integer and the date when the STS was created.
10.    A two-argument constructor that creates an STS with a specific initial fuel mass and payload mass (constructor arguments) and also initializes the STSId with a 5 digit random integer and the date when the STS was created.
11.    The accessor (get) and mutator (set) methods for manufacturer, fuelMass and payloadMass
12.    The accessor (no mutator) methods for flightTime, emptyMass, totalMass, STSId and dateCreated.
13.    A method named increseFlightTime() that increases the flight time by 5 seconds. The STS burns through 1% of its fuel for every second of flight (up to the original fuelMass).
14.    A method named deployPayload() that deploys the payload in space (mass will be affected). The STS takes 200 seconds to get to space. It cannot deploy its payload before that. Show error message if this method is called before the STS gets to space.
*Provide appropriate input validation for these methods. Print a message to the console if the arguments passed to the method do not pass the validation test(s).

Write a test program (class TestSTS) that creates an STS object and tests every method of the class. (use console output).

Leave a Comment

Your email address will not be published. Required fields are marked *