blob: a16fa470c508146b7735f2dc26db44c9e54fc2c6 (
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
|
Agile notes and Pseudocode for Lab1 Part 1
This program requires the following
2 inputs:
length of the kite in meters
width of the kite in meters
Notes:
Ask the user for width and length in cm
Print what the user entered for width and length
Computer the area of the kite using Area=(width x length)/2
Convert the square cm to square m by dividing by 10000
Print area in sq m, this uses decimals
computer the aspect ratio of the kite. Aspect ratio is width/length
If the aspect ratio is greater than 1 print a warning to user that a lower ratio would provide more stability.
Output:
Output is self documenting
Shows input with labels, then the output
Part 2
1. Edit the user input so that they can only enter widths and lengths between 1 and 400. It is ok to just
keep asking them to enter it correctly.
2. Compute the total mass of your kite:
a. Create a constant to store the mass of your kite per square meter. In the formula below, it is
referred to as mass. You may assume a medium weight fabric at about 135 Grams / Sq Meter .
3. Compute the gravitational pull on your kite.
Pseudocode for part 1:
int width
int length
float areaCM
float areaM
int ratio
begin main function
print "enter width of kite"
input width
print "enter length of kite"
input length
print "your kite has a width of: " width " and length of: " length
areaCM = width x length / 2
areaM = areaCM / 10000
ratio = width / length
if ratio >= 1
"Warning, a lower aspect ratio would provide more stability"
else
"nice aspect ratio"
print "your kite's area in square meters is: " areaM
Pseudocode for part 2
int width
int length
float areaCM
float areaM
int ratio
float totalmass
float kitegravpull
const mass = 135
const botnum = 1
const topnum = 400
const gravpull = 9.8
begin main function
print "enter width of kite"
input width
while width < botnum OR width > topnum
print enter a number for width between 1 and 400
input width
print "enter length of kite"
input length
while length < botnum OR length > topnum
print enter a number for length between 1 and 400
input length
print "your kite has a width of: " width " and length of: " length
areaCM = width x length / 2
areaM = areaCM / 10000
ratio = width / length
totalmass = areaM * mass / 1000
kitegravpull = totalmass * gravpull
if ratio >= 1
"Warning, a lower aspect ratio would provide more stability"
else
"nice aspect ratio"
print "your kite's area in square meters is: " areaM
print "your kites mass is: " + totalmass
print "your kites gravitational pull is: " + kitegravpull
|