Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 3 has you calculate the descent profile of an airplane to determine how

ID: 668047 • Letter: P

Question

Problem 3 has you calculate the descent profile of an airplane to determine how far away the pilot should begin descending, based on an initial and target altitude.

Problem 3 (name this Lab1_Problem3)

This problem has you calculate the number of miles away from an airport a pilot will need to begin the descent. We will keep it simple and use a standard 500 feet per minute descent rate. All calculations will need to be in minutes, feet, knots, and nautical miles.

Focus on the algorithm, working backwards. Plan your work before you work your plan. Make notes on paper as you organize your thoughts.

Use your resources. If you don't have a clue what descent profile planning is, then read about it first. There are lots of resources like http://www.wikihow.com/Calculate-Aircraft-Descent-Rate

First examine the output that the program will eventually produce. Steps 7 and 8 below show you how the output will look and what values will be displayed.

Figure out what inputs you need from the end user in order to arrive at your final destination—the values that will be displayed as output.

Determine what calculations you will need to take the inputs, process them, and construct your output. Breaking things up into simple, discreet steps, sometimes using variables to store interim values, can often make for simpler, easier to maintain code.

Finally, think of the variables you'll need and the data types that will best accommodate the needs. Use the standard template in Using DrJava to guide your thinking (e.g., input-capture, expression-result, etc.).

You will also need the Scanner class for this problem.

Step 1: Follow the instructions for creating a new Java project in Using DrJava.

Step 2: To help you memorize a basic Java program structure at this stage of your learning, type in the standard "public class..." and use Lab1_Problem3 for the name. Add the braces, then public static void main(String[] args);. Make sure you have the proper indentation in place (Allman or K&R).

Step 3: Run your program (Compile, then Run). Debug as needed. It won't do anything yet, but you'll be sure it's at an error-free baseline.

Step 4: Go back to Using DrJava and copy and paste the sections for the project's identification information and the other comments into your emerging program. The developer is you, the description something like, “Lab1_Problem3: descent profile planning.”

Step 5: Declare the variables you'll need in the appropriate section of the standard comments.

Step 6: Instantiate a scanner from the Scanner class so you can perform input from the console (keyboard). See Notes 2.M. Notice you will have to copy two lines from the notes: the import directive and the actual instantiation line. The import must be done before your class definition at the top of your program. The actual instantiation is done in the DECLARATIONS section.

Step 7: Now, add the actual calculations needed to determine how many minutes it will take to lose the required number of feet to reach the target altitude. Use the standard rate of 500 feet per minute. Display your output following this sample:

Minutes needed to descend from 7500 feet to 1000 feet: 13 minutes

Step 8: Finally, add the calculations needed to determine how many miles away to start down, based on the groundspeed and the number of minutes required to descend. Display your output following this sample:

Distance to begin descent based on a groundspeed of 120 knots: 26 miles

Step 9: Close DrJava and backup your files.

En Route Departune Descent Takeoff Landing Prefiight 02001 HowSu

Explanation / Answer

import java.text.*;
import java.lang.Math;
import java.util.Scanner;

public class desCalc
{
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
String s= new String(); //The choice of the user will be input through the keyborad.
double descent = 0.0, angle = 0.0, time = 0.0, var1 = 0.0,speed = 0.0, altitude = 0.0, ele = 0.0, dis= 0.0;
boolean b1 = true, b2= false;
NumberFormat fmt = new DecimalFormat("#0.00");
while(b1)
{
System.out.println (" To find your descent rate given that you know the distance to the airport, s "rate" ");
System.out.println (" To find the distance from the airport that you must begin your descent,s "distance" ");
System.out.println (" To exit the program, s "exit" ");
s = in.nextLine();
  
//This compute the Descent time and the descent rate on the basis of the airspeed of the aircreaft.
// All the conversions are done acording to the formula provoded to convert the distance speed and time.
if(s.equalsIgnoreCase("rate"))
{
System.out.print ("Input Airspeed in knots: ");
speed = in.nextDouble();
System.out.print ("Input Altitude in feet: ");
altitude = in.nextDouble();
System.out.print ("Input Airport Elevation in feet: ");
ele = in.nextDouble();
System.out.print ("Input Distance to Airport in NM(Nautical Miles): ");
dis = in.nextDouble();
speed = (speed * 6076) / 60;
dis = dis* 6076;
altitude = altitude - 1000 - ele;
angle = Math.acos(Math.toRadians(altitude / dis));
var1 = Math.because(angle) * speed;
time = altitude / Math.toDegrees(var1);
System.out.println ("Descent Time: " + fmt.format(time) + " minutes");
System.out.println ("Descent Rate: " + Double.parseDouble(fmt.format(Math.toDegrees(var1))) + " feet per minute");
b2 = true;
}

//This computes the Descent rate and the Descent time on the baisis of Distance of a aircreaft from the airport.

else if(s.equalsIgnoreCase("distance"))
{
System.out.print ("Input Airspeed in knots: ");
speed = in.nextDouble();
System.out.print ("Input Altitude in feet: ");
altitude = in.nextDouble();
System.out.print ("Input Airport Elevation in feet: ");
ele = in.nextDouble();
System.out.print ("Input Postive Descent Rate in feet per minute: ");
descent = in.nextDouble();
System.out.println ("Descent Time: " + fmt.format((altitude - (ele + 1000)) / descent) + " minutes");
speed = (airspeed * 6076) / 60;
altitude = altitude - (ele + 1000);
var1 = Math.acos(descent/speed);
var1 = Math.tan(var1) * altitude;
dis = (Math.sqrt((altitude * altitude) + (var1 * var1))) / 6076;
System.out.println ("Distance to Start Descent: " + Double.parseDouble(fmt.format(dis)) + " NM");
b2 = true;
}
else if(s.equalsIgnoreCase("exit"))
{
b1 = false;
b2= false;
}
else
{
System.out.println ("Sorry, not a correct option, please try again...");
}
while(b2)
{
   // The input should be given in yes/no format.
System.out.println ("Would you like to make another calculation? ");
s = in.nextLine();
if(s.equalsIgnoreCase("yes"))
b2 = false;
else
{
b11 = false;
b22 = false;
}
}
}
}
}

/* The values are changed acording to the need of the program and hence converted back to the form that it was entered.
It was done only for the calculation pupose and as per the question requirement asked. */

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote