You are on page 1of 4

Question 2

Step 1: START
Step 2: DECLAREi,a,b,c,d,e,f,g,mean,total,std,stdd,Good=0,Unhealthy=0,Moderate=0,
VeryUnhealthy=0,Hazardous=0 as DOUBLE.
Step 3: PRINT Enter the PSI for Day 1
Step 4: INPUT a
Step 5: IF a <= 0
ELSE proceed to Step 7
Step 6: PRINT Enter positive value only
Step 7: IF a >= 0 && a <= 50
Good++
ELSE IF a >= 51 && a <= 100
Moderate++
ELSE IF a >= 101 && a <= 200
Unhealthy++
ELSE IF a >= 201 && a <= 300
VeryUnhealthy++
ELSE IF a >= 301
Hazardous++
Step 8: PRINT Enter the PSI for Day 2
Step 9: INPUT b
Step 10: IF b <= 0
ELSE proceed to Step 12
Step 11: PRINT Enter positive value only
Step 12:IF b >= 0 && b<= 50
Good++
ELSE IF b >= 51 && b <= 100
Moderate++
ELSE IF b >= 101 && b <= 200
Unhealthy++
ELSE IF b >= 201 && b <= 300
VeryUnhealthy++
ELSE IF b >= 301
Hazardous++
Step 13: PRINT Enter the PSI for Day 3
Step 14: INPUT c
Step 15: IF c <= 0
ELSE proceed to Step 17
Step 16: PRINT Enter positive value only




Step 17:IF c >= 0 && c <= 50
Good++
ELSE IF c >= 51 && c <= 100
Moderate++
ELSE IF c >= 101 && c <= 200
Unhealthy++
ELSE IF c >= 201 && c <= 300
VeryUnhealthy++
ELSE IF c >= 301
Hazardous++
Step 18: PRINT Enter the PSI for Day 4
Step 19: INPUT d
Step 20: IF d <= 0
ELSE proceed to Step 22
Step 21: PRINT Enter positive value only
Step 22: IF d >= 0 && d <= 50
Good++
ELSE IF d >= 51 && d <= 100
Moderate++
ELSE IF d >= 101 && d <= 200
Unhealthy++
ELSE IF d >= 201 && d <= 300
VeryUnhealthy++
ELSE IF d >= 301
Hazardous++
Step 23: PRINT Enter the PSI for Day 5
Step 24: INPUT e
Step 25: IF e <= 0
ELSE proceed to Step 27
Step 26: PRINT Enter positive value only
Step 27:IF e >= 0 && e <= 50
Good++
ELSE IF e >= 51 && e <= 100
Moderate++
ELSE IF e >= 101 && e <= 200
Unhealthy++
ELSE IF e>= 201 && e<= 300
VeryUnhealthy++
ELSE IF e >= 301
Hazardous++
Step 28: PRINT Enter the PSI for Day 6
Step 29: INPUT f
Step 30: IF f <= 0
ELSE proceed to Step 42
Step 41: PRINT Enter positive value only
Step 42:IF f >= 0 && f <= 50
Good++
ELSE IF f >= 51 && f <= 100
Moderate++
ELSE IF f >= 101 && f <= 200
Unhealthy++
ELSE IF f >= 201 && f <= 300
VeryUnhealthy++
ELSE IF f >= 301
Hazardous++
Step 43: PRINT Enter the PSI for Day 7
Step 44: INPUT g
Step 45: IF e <= 0
ELSE proceed to Step 47
Step 46: PRINT Enter positive value only
Step 47: IF g >= 0 && g <= 50
Good++
ELSE IF g >= 51 && g <= 100
Moderate++
ELSE IF g >= 101 && g <= 200
Unhealthy++
ELSE IF g >= 201 && g <= 300
VeryUnhealthy++
ELSE IF g >= 301
Hazardous++
Step 48: Get the total of all the inputs by a + b + c + d + e + f + g
Step 49: PRINT The total PSI for 7 day is :
Step 50: Get the mean of the inputs by total/7
Step 51: PRINT The mean of PSI for 7 days is :
Step 52: Get the standard deviation by {(a-mean)*(a-mean) + (b-mean)*(b-mean) + (c-mean)*(c-
mean) + (d-mean)*(d-mean) + (e-mean)*(e-mean) + (f-mean)*(f-mean) + (g-mean)*(g-mean)} /7
Step 53: PRINT The standard deviation PSI is :
Step 54: PRINT Bar Chart
Step 55: PRINT Air Quality PSI
Step 56: PRINT Good
Step 57: for (i=0; i<Good;i++)
Step 58: PRINT *
Step 59: PRINT Moderate
Step 60: FOR (i=0; i<Moderate;i++)
Step 61: PRINT *
Step 62: PRINT Unhealthy
Step 63: FOR (i=0; i<Unhealthy;i++)
Step 64: PRINT *
Step 65: PRINT Very Unhealthy
Step 66: FOR (i=0; i<Very Unhealthy;i++)
Step 67: PRINT *
Step 68: PRINT Hazadous
Step 69: FOR (i=0; i<Hazardous;i++)
Step 70: PRINT *
Step 71: END

You might also like