Millennium Falcon
PLEASE PROVIDE THE CODE BELOW
You are the systems navigator aboard the Millennium Falcon (the original Star Wars’ vessel
of Han Solo]. It is your job to issue the “GO, NO GO, FOR LAUNCH” command. Each of
your crew persons will respond with “GO” or “NO GO” based upon the minimum percent
efficiency needed for their systems to function properly during launch. Your crew and their
minimum necessary systems efficiency ratings are:
R2D2 40%
C3PO 50%
Han Solo 30%
Luke Skywalker 20%
Chewbacca 35%
Princess Leia 45%
If a crew person issues the “NO GO” response, you must start again with the first crew
member and make another attempt at launch. You will use the computer clock to determine
how long it takes your simulation to get a final “GO” response from all of your crew
members.
Put together your screen to show a listing of the results of each run through your looping process.
A possible display is shown below.
When the final “GO” for launch sequence is obtained, a message will appear on the screen
stating “WE ARE GO FOR LAUNCH!”. Also display the time it took to achieve the launch
simulation, and how many “runs” were needed to get the go for launch.
Your program is to contain the following:
an opening title showing your Star Wars’ name as the system navigator.
method calls to each of your crew members. public static int R2D2 ( );
These methods are to take no arguments.
These methods should include:
* The generation of random numbers from 1 to 100.
These numbers from 1 to 100 will represent the percent efficiency at which the
system is operating. For example, the generation of 36 implies that the system is
operating at 36% efficiency.
* A return char or int indicating a “Go” (‘G’ or 1) or “No Go” (‘N’ or 0) response.
A grade of 100 requires *spiff*.
Suggestion: Yoda is on board. If the ship fails to launch after 20 tries (“runs”), Yoda can be
called upon to launch the ship using the power of the “Force”.
May the Force Be With You!