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

Java code: please help me with the following java lab, thank you! E6B Flight Com

ID: 3870733 • Letter: J

Question

Java code:

please help me with the following java lab, thank you!

E6B Flight Computer The E6B flight computer is a type of slide rule that pilots and navigators traditionally use for performing a variety of calculations. In our E6B, we want to perform the calculations to compute the follo wing: Density altitude. The following is from the Wikipedia Density altitude is the altitude relative to the standard atmosphere conditions (ISA) at which the air density would be equal to the indicated air density at the place of observation. In other words, density altitude is air density given as a height above mean sea level. "Density altitude" can also be considered to be the pressure altitude adjusted for non-standard temperature. Both an increase in temperature, decrease in atmospheric pressure, and, to a much lesser degree, increase in humidity will cause an increase in density altitude. In hot and humid conditions, the density altitude at a particular location may be significantly higher than the true altitude In aviation, the density altitude is used to assess the aircraft's aerodynamic performance under certain weather conditions. The lift generated by the aircraft's airfoils and the relation between indicated and true airspeed are also subject to air density changes. Furthermore, the power delivered by the aircraft's engine is affected by the air density and air composition. Iculating Density Altitude The National Weather Service uses the following dry-air approximation equation in their standards: 17326P0.235 59.67 T DA = 145442.16 | 1 where DA = density altitude in feet P is the station pressure (atmospheric static pressure) in inches of mercury (inHg). Tis the station temperature (atmospheric temperature) in Fahrenheit (F) Note that the NWS standard specifies that the density altitude should be rounded to the nearest 100 feet. You will need to add the DA to the airport elevation to arrive at the final result. Your code should implement a density altitude function; public double densityAltitude ()

Explanation / Answer

import java.util.Scanner;

public class E6BFlightComputer {

// instance variables

private double P;

private double T;

private double DA;

private int altitude;

private int IAS;

private double TAS;

private double w;

private double d;

private double Vw;

private double a;

private double Vg;

public E6BFlightComputer()

{

this.P = 0;

this.T = 0;

this.altitude = 0;

this.IAS = 0;

this.w = 0;

this.d = 0;

this.Vw = 0;

}

// parameterized constructor

public E6BFlightComputer(double p, double t, int altitude, int iAS, double w, double d, double vw)

{

P = p;

T = t;

this.altitude = altitude;

IAS = iAS;

this.w = w;

this.d = d;

Vw = vw;

calcDensityAltitude();

calcTrueAirSpeed();

calcWindCorrectionAngle();

calcGroundSpeed();

}

// getters and setters

public double getStationPressure() {

return P;

}

public double getStationTemperature() {

return T;

}

public double getDensityAltitude() {

return DA;

}

public int getAltitude() {

return altitude;

}

public int getIAS() {

return IAS;

}

public double getWindDirection() {

return w;

}

public double getDesiredCourse() {

return d;

}

public double getTrueAirSpeed() {

return TAS;

}

public double getWindSpeed() {

return Vw;

}

public double getGroundSpeed()

{

return this.Vg;

}

public void setStationPressureP(double p) {

P = p;

}

public void setStationTemperature(double t) {

T = t;

}

public void setAltitude(int altitude) {

this.altitude = altitude;

}

public void setIAS(int iAS) {

IAS = iAS;

}

public void setWindDirection(double w) {

this.w = w;

}

public void setDesiredCouse(double d) {

this.d = d;

}

public void setWindSpeed(double vw) {

Vw = vw;

}

private void calcDensityAltitude()

{

double temp = Math.pow( (17.326*this.P / (459.67 + this.T) ), 0.235 );

this.DA = 145442.16*(1 - temp);

}

private void calcTrueAirSpeed()

{

this.TAS = (double)this.IAS+(this.altitude/1000)*0.02*this.IAS;

}

private void calcWindCorrectionAngle()

{

this.a = Math.asin(this.Vw*Math.sin(this.w - this.d) / this.TAS);

}

private void calcGroundSpeed()

{

double d = Math.toRadians(this.d);

double w = Math.toRadians(this.w);

double a = Math.toRadians(this.a);

double temp = 2*this.TAS*this.Vw*Math.cos( d - w + a);

this.Vg = Math.sqrt( (this.TAS*this.TAS) + (this.Vw*this.Vw) - temp);

}

// main method

public static void main(String args[])

{

double stationP, stationT, airportE;

int aircraftA;

int Iairspeed;

double desiredC, windD, windS;

Scanner kybd = new Scanner(System.in);

System.out.print("Enter the station Pressure in Hg: ");

stationP = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the station Temperature in F: ");

stationT = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the aircraft altitude in feet: ");

aircraftA = Integer.parseInt(kybd.nextLine());

System.out.print("Enter the indicated airspeed in knots: ");

Iairspeed = Integer.parseInt(kybd.nextLine());

System.out.print("Enter the desired course: ");

desiredC = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the wind direction: ");

windD = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the wind speed in knots: ");

windS = Double.parseDouble(kybd.nextLine());

E6BFlightComputer FC = new E6BFlightComputer(stationP, stationT, aircraftA, Iairspeed,

windD, desiredC, windS);

System.out.printf("Density Altitude: .2f ", FC.getDensityAltitude());

System.out.println("True air speed: " + FC.getTrueAirSpeed());

System.out.println("Wind correction angle: " + FC.getTrueAirSpeed());

System.out.println("Ground speed: " + FC.getGroundSpeed());

}

}

Java Code

import java.util.Scanner;

public class E6BFlightComputer {

// instance variables

private double P;

private double T;

private double DA;

private int altitude;

private int IAS;

private double TAS;

private double w;

private double d;

private double Vw;

private double a;

private double Vg;

public E6BFlightComputer()

{

this.P = 0;

this.T = 0;

this.altitude = 0;

this.IAS = 0;

this.w = 0;

this.d = 0;

this.Vw = 0;

}

// parameterized constructor

public E6BFlightComputer(double p, double t, int altitude, int iAS, double w, double d, double vw)

{

P = p;

T = t;

this.altitude = altitude;

IAS = iAS;

this.w = w;

this.d = d;

Vw = vw;

calcDensityAltitude();

calcTrueAirSpeed();

calcWindCorrectionAngle();

calcGroundSpeed();

}

// getters and setters

public double getStationPressure() {

return P;

}

public double getStationTemperature() {

return T;

}

public double getDensityAltitude() {

return DA;

}

public int getAltitude() {

return altitude;

}

public int getIAS() {

return IAS;

}

public double getWindDirection() {

return w;

}

public double getDesiredCourse() {

return d;

}

public double getTrueAirSpeed() {

return TAS;

}

public double getWindSpeed() {

return Vw;

}

public double getGroundSpeed()

{

return this.Vg;

}

public void setStationPressureP(double p) {

P = p;

}

public void setStationTemperature(double t) {

T = t;

}

public void setAltitude(int altitude) {

this.altitude = altitude;

}

public void setIAS(int iAS) {

IAS = iAS;

}

public void setWindDirection(double w) {

this.w = w;

}

public void setDesiredCouse(double d) {

this.d = d;

}

public void setWindSpeed(double vw) {

Vw = vw;

}

private void calcDensityAltitude()

{

double temp = Math.pow( (17.326*this.P / (459.67 + this.T) ), 0.235 );

this.DA = 145442.16*(1 - temp);

}

private void calcTrueAirSpeed()

{

this.TAS = (double)this.IAS+(this.altitude/1000)*0.02*this.IAS;

}

private void calcWindCorrectionAngle()

{

this.a = Math.asin(this.Vw*Math.sin(this.w - this.d) / this.TAS);

}

private void calcGroundSpeed()

{

double d = Math.toRadians(this.d);

double w = Math.toRadians(this.w);

double a = Math.toRadians(this.a);

double temp = 2*this.TAS*this.Vw*Math.cos( d - w + a);

this.Vg = Math.sqrt( (this.TAS*this.TAS) + (this.Vw*this.Vw) - temp);

}

// main method

public static void main(String args[])

{

double stationP, stationT, airportE;

int aircraftA;

int Iairspeed;

double desiredC, windD, windS;

Scanner kybd = new Scanner(System.in);

System.out.print("Enter the station Pressure in Hg: ");

stationP = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the station Temperature in F: ");

stationT = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the aircraft altitude in feet: ");

aircraftA = Integer.parseInt(kybd.nextLine());

System.out.print("Enter the indicated airspeed in knots: ");

Iairspeed = Integer.parseInt(kybd.nextLine());

System.out.print("Enter the desired course: ");

desiredC = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the wind direction: ");

windD = Double.parseDouble(kybd.nextLine());

System.out.print("Enter the wind speed in knots: ");

windS = Double.parseDouble(kybd.nextLine());

E6BFlightComputer FC = new E6BFlightComputer(stationP, stationT, aircraftA, Iairspeed,

windD, desiredC, windS);

System.out.printf("Density Altitude: .2f ", FC.getDensityAltitude());

System.out.println("True air speed: " + FC.getTrueAirSpeed());

System.out.println("Wind correction angle: " + FC.getTrueAirSpeed());

System.out.println("Ground speed: " + FC.getGroundSpeed());

}

}

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