// CST116-Lab1-Smith.cpp : This file contains the 'main' function. Program execution begins and ends there. /*Benjamin Smith * CST116 * Lab 1 * Input and Output and If statements * Loops and Simple Calculations */ #include using std::cin; using std::cout; using std::endl; //Initializing Variables float w, l, area, aspect_ratio, mass, grav_pull; const float mass_per = .135; int main() { //Collecting the length and width of the kite in centimeters cout << "Please input the width of the kite in centimeters." << endl; cin >> w; while (w < 1 || w > 400) { cout << "That number is invalid. Please try again with a number between 1 and 400." << endl; cin >> w; } cout << "Now please input the length of the kite in centimeters." << endl; cin >> l; while (l < 1 || l > 400) { cout << "That number is invalid. Please try again with a number between 1 and 400." << endl; cin >> l; } //Doing the math to convert the centimeter inputs to square meter outputs area = (w * l) / 2; area /= 10000; //Displaying the area in square meters cout << "The area of the kite will be: " << area << " m^2." << endl << endl; //Setting the aspect ratio of width to length aspect_ratio = w / l; //Determining if the aspect ratio is too high if (aspect_ratio >= 1) { cout << "Your aspect ratio of width to length is: " << aspect_ratio << ", which is quite high." << endl << "It is recommended to use a smaller aspect ratio to maintain stability." << endl << endl; } //Calculate then output the mass of the kite mass = mass_per * area; cout << "The total mass of your kite will be: " << mass << " kg." << endl << endl; //Calculate then output the gravitational pull of the kite grav_pull = mass * 9.8; cout << "The gravitational pull on your kite will be: " << grav_pull << " N/kg." << endl; return 0; }