// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. // // Name: Taylor Rogers // CST116 Lab1 #include #include using std::cout; using std::cin; using std::endl; using std::fixed; using std::showpoint; using std::setprecision; int main() { int kwidth, klength; cout << fixed << showpoint << setprecision(2); // Kite Parameters cout << "What is the width of the kite in centimeters?: "; cin >> kwidth; while (kwidth < 1) { cout << "Please enter a width between 1 and 400 centimeters: "; cin >> kwidth; while (kwidth > 400) { cout << "Please enter a width between 1 and 400 centimeters: "; cin >> kwidth; } } while (kwidth > 400) { cout << "Please enter a width between 1 and 400 centimeters: "; cin >> kwidth; while (kwidth < 1) { cout << "Please enter a width between 1 and 400 centimeters: "; cin >> kwidth; } } cout << endl; cout << "What is the length of the kite in centimeters? "; cin >> klength; while (klength < 1) { cout << "Please enter a length between 1 and 400 centimeters: "; cin >> klength; while (klength > 400) { cout << "Please enter a length between 1 and 400 centimeters: "; cin >> klength; } } while (klength > 400) { cout << "Please enter a length between 1 and 400 centimeters: "; cin >> klength; while (klength < 1) { cout << "Please enter a length between 1 and 400 centimeters: "; cin >> klength; } } // Math float karea = ( ((float)kwidth) * klength ) / 2; float ksqm = karea / 10000; float kasp = ((float)kwidth) / klength; float kmass = ksqm * 0.135; float kgrav = kmass * 9.8; cout << endl; // Kite Parameter Output cout << "The kite is " << kwidth << " centimeters wide and " << klength << " centimeters long." << endl; cout << endl; cout << "The kite has an area of " << ksqm << " square meters." << endl; cout << endl; // Kite Aspect Ratio if (kasp >= 1) cout << "An aspect ratio of <1 will provide more stability. The current aspect ratio is " << kasp << "." << endl; else cout << "Your aspect ratio is " << kasp << "." << endl; cout << endl; // Kite Mass cout << "Assuming a canvas weight of 135g per square meter, the mass of your kite is "; cout << kmass << "kg." << endl; cout << endl; // Kite Gravitational Pull cout << "The gravitational pull on your kite is "; cout << kgrav << "N." << endl; }