summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
blob: 955e418bb2e9748d8d575a95a2da210916520ba6 (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
120
121
122
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
// Name: Taylor Rogers
// CST116 Lab1

#include <iostream>
#include <iomanip>

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;


}