/* CST116 - C++ Programming Abdullah Havaldar abdullah.havaldar@oit.edu Purpose: The purpose of this code is to find the area for a kite which the user enters the values of the width and height and give out the area of the kite */ #include using namespace std; using std::cout; using std::cin; using std::endl; int main() { //seting up variables float length, width, area, aspectRatio, mass, gPull; bool glength = false; bool gwidth = false; //makes user input length between 1 and 400 while (!glength) { cout << "Please enter the length of your kite." << endl; cin >> length; if (length >= 400 || length <= 1) { cout << "Please enter a length between 1 and 400. " << endl; } else { glength = true; break; } } //makes user input width between 1 and 400 while (!gwidth) { cout << "Please enter the width of your kite." << endl; cin >> width; if (width >= 400 || width <= 1) { cout << "Please enter a width between 1 and 400. " << endl; } else { gwidth = true; break; } } //output confirmation stating what the user input cout << "So the length is " << length << "cm and the width is " << width << "cm." << endl; //calculating area and turning it to square meteres area = ((width * length) / 2); area /= 10000; //telling the user how many square meters their kite is cout << "The area of your kite is " << area << " square meters." << endl; //calculating aspect ratio aspectRatio = width / length; //warns user if aspect ratio is greater than or equal to 1 if (aspectRatio >= 1) { cout << "NOTE: A lower aspect ratio (below 1) would provide more stability" << endl; } //calculating mass of kite mass = (area * 135) / 1000; //calculating gravitational pull gPull = mass * 9.8; //output the weight of kite to user cout << "Your kite weighs " << gPull << " kg."; }