summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
blob: 224af44d0ab6489d3680a2089ad6042380937323 (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
/*
CST116 - C++ Programming
Abdullah Havaldar
[email protected]

Purpose:

The purpose of this code is to find the area for a kite which the user enters the values of the width and height
and give out the area of the kite
*/

#include <iostream>

using namespace std;

using std::cout;
using std::cin;
using std::endl;

int main()
{
    //seting up variables
    float length, width, area, aspectRatio;
    bool dimensions = false;

    //keeps on looping until the user inputs a length and a width between 1 and 400
    while (!dimensions)
    {
        //output prompt for user to enter length and width
        cout << "Please enter the length and width of your kite (in that order)." << endl;
        cin >> length >> width;

        //output confirmation stating what the user input
        cout << "So the length is " << length << "cm and the width is " << width << " cm." << endl;

        if (width > 400 || length > 400 || width < 1 || length < 1) 
        {
            cout << "Please enter a width and length between 1 - 400. " << endl;
        }
        else {
            dimensions = true;
            break;
        }
    }

    //calculating area and turning it to square meteres
    area = ((width * length) / 2);
    area /= 10000;

    //telling the user how many square meters their kite is
    cout << "The area of your kite is " << area << " square meters." << endl;

    //calculating aspect ratio
    aspectRatio = width / length;

    //warns user if aspect ratio is greater than or equal to 1
    if (aspectRatio >= 1)
    {
        cout << "WARNING: The aspect ratio of your kite is pretty high which would result in less stability. Making a lower aspect ratio would provide more stability.";
    }




}