Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Write a program called LandThePlane that calculates whether a plane successfully lands or not.
 
The program begins by prompting (asking) the user for the following details, in the order shown in the example below.
 
Distance to airport (in metres)   - an integer value

Name of the airport     - text, can be more than one word

Current height (in metres)   - an integer value

Current speed (in kilometres / hour) - an integer value

Current fuel (in litres)    - an integer value

Next the user is prompted (asked) to enter an integer figure between -4 and +4 inclusive. This figure is the Engine change figure, which changes the speed of the plane and how fast the plane is losing height, as explained below.

Assume that the speed change occurs immediately. 

This program operates in metres and seconds. First the speed must be converted from kilometres / hour to metres / sec. The conversion factor is 0.27777.
 
That is, 1 km / hr = 0.27777 m /s
 
Based on the Acceleration change figure entered by the user, the new speed is calculated, using the formula
 
new speed = old speed + ( old speed * Acceleration change )
 
This new speed is still in metres / second, and becomes the current speed.
 
Recall that the new speed is applied immediately.
 
Next the program, using the new speed, works out the new distance to the airport by subtracting how much distance has been covered, at this new speed, in 10 seconds. 
 
The formula is:
 
new distance = old distance - (current speed * time) 
(where time = 10 seconds)
 
This gives a new figure, in metres, of the distance to the airport. This figure can be negative, as is explained below.
 
Next, the program calculates the new height of the plane, also in meters. This figure may also be negative, as is explained below. 

new height = old height -  ( current speed * rate of descent * time )

where
   time = 10 seconds
   rate of descent = 0.1369
 
Regardless of whether the plane increases or decreases speed, the plane always loses height (goes lower)
 
The plane uses 200 litres of fuel every 10 seconds.
 
To successfully land the plane distance must be between 0 and -300 AND height must be 0 or less AND fuel must be 0 or greater AND speed must be 0 or greater.
 
 why can distance be < 0?
 
  0 represents the very edge of the runway, so long as the plane touches down within the first 300 metres of the runway, then it has enough runway to slow down to a stop. If the plane lands any further down the runway, then it does not have enough runway to stop in time and crashes off the end of the runway.

 why can height be < 0?
 
  We are using a time slice of 10 seconds. The plane could successfully land anywhere within this 10 second window but the calculations could show a negative value. For instance, if the plane landed successfully in the first second of the 10 second window, the program would still be calculating the change in height for the remaining 9 seconds of the time slice, so the final, displayed answer, would be negative.

Java, Programming

  • Category:- Java
  • Reference No.:- M9522394

Have any Question?


Related Questions in Java

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As