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

3.22 P03-01 Wing Design NOTE: There are two due dates for the assignment to allo

ID: 3746949 • Letter: 3

Question

3.22 P03-01 Wing Design NOTE: There are two due dates for the assignment to allow for late submissions. The earliest due date on all Projects in these Zybooks is the actual due date (see syllabus if you ever have any doubts). The later due date on all Projects is for accepting late submissions (submissions submitted less than or equal to 24 hours after the actual due date) The lab exercise this week (Week 03) was to write a program to compute the wing loading value (WLV), defined as the weight of an airplane (in kg) divided by its wing area (in mA2). Airplanes with low wing loading values are easy to maneuver, but uncomfortable. Airplanes with high wing loading values are more comfortable, but less maneuverable In this exercise an engineer is trying to design an aircraft with a WLV in the range 290.0-310.0, inclusive. You're going to write a C++ program to help the engineer in their design work. The program will input two real numbers, the weight (in kg) followed by the wing area (in mA2), and then compute the WLV. If the WLV falls within the design range of 290.0-310.0, inclusive, the program outputs 'design: good" However, if the WLV falls outside this range, the program outputs how the wing area should change to achieve a WLV of 300.0 Example: suppose the inputs are (denoting weight and wing area, respectively) 38000.0 124.5 In this case the WLV is 305.221, so the program outputs WLV: 305.221 design: good because the WLV falls with the design goal of 290.0-310.0, inclusive. Note there is one space following each , and each line should be followed by C++ endl. However, suppose the inputs are 32000.0 99.2 The WLV 322.581, which is too high and implies the wing is too small. So the program outputs WLV: 322.581 design: increase wing area by 7.46667m 2

Explanation / Answer

PROGRAM

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

double wWeight,wArea,WLV; // declare double variables

while(1) // create infinite while loop until press 0

{

cout<<" Weight of an Airplane (ENTER 0 TO EXIT): ";

cin>>wWeight; // read wing weight

if(wWeight==0) break; // check weight=0 then exit from while loop

cout<<"Wing Area: ";

cin>>wArea; // read wing area

WLV=wWeight/wArea; // calculate wing loading value

if(WLV>=290.0&&WLV<=310.0) // check condition wing loading value in between 290 to 310

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: good"<<endl; // print design

}

if(WLV<290.0) // check condition wing loading value <290

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: reduce wing area by "<<(wWeight/300.0)-wArea<<" m^2"<<endl; // display design

}

if(WLV>310) // check condition wing loading value >310

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: increase wing area by "<<(wWeight/300.0)-wArea<<" m^2"<<endl; // display design

}

}

return 0;

}

OUTPUT


Weight of an Airplane (ENTER 0 TO EXIT): 38000
Wing Area: 124.5

WLV: 305.221
design: good

Weight of an Airplane (ENTER 0 TO EXIT): 32000
Wing Area: 99.2

WLV: 322.581
design: increase wing area by 7.46667 m^2

Weight of an Airplane (ENTER 0 TO EXIT): 28500
Wing Area: 102.25

WLV: 278.729
design: reduce wing area by -7.25 m^2

Weight of an Airplane (ENTER 0 TO EXIT): 0

CHANGED PROGRAM ACCORDING TO YOUR REQUIREMENTS

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

double wWeight,wArea,WLV; // declare double variables

while(1) // create infinite while loop until press 0

{

cout<<" Weight of an Airplane (ENTER 0 TO EXIT): ";

cin>>wWeight; // read wing weight

if(wWeight==0) break; // check weight=0 then exit from while loop

cout<<"Wing Area: ";

cin>>wArea; // read wing area

WLV=wWeight/wArea; // calculate wing loading value

if(WLV>=290.0) // check condition wing loading value <290

{

if(WLV>=290.0&&WLV<=310.0) // check condition wing loading value in between 290 to 310

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: good"<<endl; // print design

}

/*if(WLV<290.0) // check condition wing loading value <290

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: reduce wing area by "<<(wWeight/300.0)-wArea<<" m^2"<<endl; // display design

}*/

if(WLV>310) // check condition wing loading value >310

{

cout<<" WLV: "<<WLV<<endl; // then, print wing loading value

cout<<"design: increase wing area by "<<(wWeight/300.0)-wArea<<" m^2"<<endl; // display design

}

}

else

cout<<"Invalid Data.."<<endl;

}

return 0;

}

OUTPUT:


Weight of an Airplane (ENTER 0 TO EXIT): 38000
Wing Area: 124.5

WLV: 305.221
design: good

Weight of an Airplane (ENTER 0 TO EXIT): 32000
Wing Area: 99.2

WLV: 322.581
design: increase wing area by 7.46667 m^2

Weight of an Airplane (ENTER 0 TO EXIT): 28500
Wing Area: 102.25
Invalid Data..

Weight of an Airplane (ENTER 0 TO EXIT): 35600
Wing Area: 95.55

WLV: 372.58
design: increase wing area by 23.1167 m^2

Weight of an Airplane (ENTER 0 TO EXIT): 26500
Wing Area: 66.55

WLV: 398.197
design: increase wing area by 21.7833 m^2

Weight of an Airplane (ENTER 0 TO EXIT): 25600
Wing Area: 122.25
Invalid Data..

Weight of an Airplane (ENTER 0 TO EXIT): 0

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