blob: cec5902d7037aa2b7f627068a2f5c15ec84525dd (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <iomanip>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
float GetLength();
float GetWidth();
//void CalcArea(float length, float width);
int main()
{
float length = 0;
float width = 0;
float area = 0;
float aspectRatio = 0;
float mass = 0;
const int fabricWeight = 135;
float gravitationalPull = 0;
length = GetLength();
width = GetWidth();
//CalcArea(length, width);
cout << endl << endl << "Length: " << length << endl;
cout << "Width: " << width << endl;
area = (width * length) / 2;
area = area / 10000;
cout << endl << "The area of you kite is " << area << " square meters." << endl;
aspectRatio = width / length;
cout << "Your kite's aspect ratio is: " << aspectRatio << endl;
if (aspectRatio > 1)
{
cout << endl << "WARNING: Aspect ratio is too high. A lower aspect ratio will provide greater stability. Consider increasing the kite's aspect ratio." << endl;
}
mass = (area * fabricWeight) / 1000;
cout << endl << "Your kite weighs " << mass << " kg.";
gravitationalPull = mass * 9.8;
cout << endl << "The gravitational pull on your kite is " << gravitationalPull << " N/kg" << endl;
return 0;
}
float GetLength()
{
float length;
cout << "Enter kite length in centimeters: ";
cin >> length;
while (length > 400)
{
cout << "Length is too large. Must be less than 400." << endl;
cout << "Enter kite length in centimeters: ";
cin >> length;
}
while (length < 1)
{
cout << "Length is too small. Must be greater than 1." << endl;
cout << "Enter kite length in centimeters: ";
cin >> length;
}
return length;
}
float GetWidth()
{
float width;
cout << "Enter kite width in centimeters: ";
cin >> width;
while (width > 400)
{
cout << "Width is too large. Must be less than 400." << endl;
cout << "Enter kite width in centimeters: ";
cin >> width;
}
while (width < 1)
{
cout << "Width is too small. Must be greater than 1." << endl;
cout << "Enter kite width in centimeters: ";
cin >> width;
}
return width;
}
/*
float CalcArea(float length, float width)
{
float area;
cout << endl << endl << "Length: " << length << endl;
cout << "Width: " << width << endl;
area = (width * length) / 2;
area = area / 10000;
cout << endl << "The area of you kite is " << area << " square meters." << endl;
return area;
}
*/
|