Java: Wing Class Lab Please elp me finish the remaining requirement of the lab,
ID: 3884020 • Letter: J
Question
Java: Wing Class Lab
Please elp me finish the remaining requirement of the lab, thank you! I will rate the answer!
I have attached the lab requirment and the code I have below:
public class RectangularWing implements AirDensity
{
private double span;
private double chord;
private double vCruise;
private double vStall;
private double cLiftMax;
private double cLiftCruise;
private int altitudeTO;
private int altitudeCruise;
public RectangularWing(double s, double c,double vC,double vS, double cLmax, double cLcruise, int altTO, int altC)
{
span = s; chord = c;
vCruise = vC * 1.689;
vStall = vS * 1.689;
cLiftMax = cLmax;
cLiftCruise = cLcruise;
altitudeTO = altTO;
altitudeCruise = altC;
}
public double q(int mode)
{
double rho = 0;
double v = 0;
if (mode == TAKEOFF)
{
rho = AIR_DENSITY[altitudeTO];
v = vStall*1.3;
}
else
{
rho = AIR_DENSITY [altitudeCruise];
v = vCruise;
}
return 0.5*rho*(v*v);
}
public static void main(String[] args)
{
RectangularWing w = new RectangularWing( 30, 4.6, 120, 45,1.4, 0.3, 0,3);
System.out.println(w.q(TAKEOFF));
}
}
Explanation / Answer
public interface AirDensity {
double AIR_DENSITY[]= {0.002378,0.002309194,0.002241921,0.002176195};//in interface all variables are public final so no need to decalre
//them as final variables
int TAKEOFF=0;
int CRUISE=1;
}
public class RectangularWing implements AirDensity {
private double span;
private double chord;
private double vCruise;
private double vStall;
private double cLiftMax;
private double cLiftCruise;
private int altitudeTO;
private int altitudeCruise;
public RectangularWing(double s, double c, double vC, double vS, double cLmax, double cLcruise, int altTO, int altC)
{
span = s;
chord = c;
vCruise = vC * 1.689;
vStall = vS * 1.689;
cLiftMax = cLmax;
cLiftCruise = cLcruise;
altitudeTO = altTO;
altitudeCruise = altC;
}
public double q(int mode) {
double rho = 0;
double v = 0;
if (mode == TAKEOFF) {
rho = AIR_DENSITY[altitudeTO];
v = vStall * 1.3;
} else {
rho = AIR_DENSITY[altitudeCruise];
v = vCruise;
}
return 0.5 * rho * (v * v);
}
public double totalLift(int mode)
{
double lift=span*chord*q(mode)*cLiftCruise;
return lift;
}
public double wingLoading(int mode)
{
double loading=totalLift(mode)/(span*chord);
return loading;
}
public static void main(String[] args) {
RectangularWing w = new RectangularWing(30, 4.6, 120, 45, 1.4, 0.3, 0, 3);
System.out.println(w.q(TAKEOFF));
System.out.println(w.totalLift(TAKEOFF));
System.out.println(w.wingLoading(TAKEOFF));
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.