Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java netbeans. please read instructions carefully. Thabk you We are going to build a simulator for a lunar lander. We have to send it commands
java netbeans. please read instructions carefully. Thabk you
We are going to build a simulator for a lunar lander.
We have to send it commands to prepare it to land.
track distance from surface - start at 10
have a variable for x axis tilt and y axis tilt, start as random values between -10 and 10
commands we can send are:
x axis tilt positive or negative - this changes the value by +1 or -1
y axis tilt positive or negative - this changes the value by +1 or -1
thruster - increase distance from surface by 2 ( pretend we have unlimited fuel )
do nothing - don't change any tilt
activate self destruct sequence -
if this is used, ask the user for the cancelation code ( make up some value ), and don't let them enter other commands until they cancel
if the command entered doesn't match, give the user a list of valid commands
Inside a loop that runs until it has landed ( distance to surface is 0 )
ask for a command, do the command or give them the valid of list of commands
distance from surface goes down by 1 if a valid command was entered
if we landed and the x and y tilts are not 0, the lander breaks, game over, otherwise we win
all of this goes into another loop asking if they want to play again.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started