blob: 5d0a0796a2dc358ba6a97aa9d4baeb39f764170d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
/*
Wyatt Johnson
CST 116
Lab1
*/
#include <iostream>
using namespace std;
const float kite_weight = 135;
const float gravitational_constant = 9.8;
int main()
{
float width = 0, length = 0;
while (width < 1 || width > 400)
{
cout << "Please input your kites width in centimeters: ";
cin >> width;
cout << endl;
if (width < 1 || width > 400)
{
cout << "Width cannot be greater than 400 or less than 1." << endl;
}
}
while (length < 1 || length > 400)
{
cout << "Please input your kites length in centimeters: ";
cin >> length;
cout << endl;
if (length < 1 || length > 400)
{
cout << "Length cannot be greater than 400 or less than 1." << endl;
}
}
cout << "Your kites width will be: " << width << " cm\nYour kites length will be: " << length << " cm" << endl;
float area = ((width * length)/2) / 10000;
cout << "The area of your kite in square meters is " << area << endl;
float aspect_ratio = width / length;
if (aspect_ratio > 1)
{
cout << "Your aspect ration is greater than 1 (width/length: " << width << "/" << length << " = " << aspect_ratio << ")\nLower aspect ratios will have greater stability." << endl;
}
float mass = (area * kite_weight) / 10000;
cout << "Your kites mass is: " << mass << "kg." << endl;
float gravitational_pull = mass * gravitational_constant;
cout << "The kites gravitational pull is: " << gravitational_pull << "N/kg." << endl;
}
|