# Small Basics - 12 Month Rainfall • ### Question

• I have this same assignment and been working on it for days learning the program.  I am unsure how to calculate total rainfall all my program is dislaying is enter rainfall for Jan-Dec and nothing else. Help please.

Design a program to ask the user to enter the inches of rainfall for the 12
months for a year. The program then calculates and display the total rainfall
and average monthly rainfall. The average monthly rainfall is the total rainfall
divides 12. If the average monthly rainfall is greater than 10, then display a
message "Too much rainfall this year".

Hints:

1. you need to use a loop to get the rainfall of the 12 months and calculates
the total rainfall.

2. You need a if statement to display the message when the average monthly
rainfall is greater than 10.

3. Make sure you read the powerpoints in the docushare before you start the
assignment.

4. You can also find free online tutorial for Small Basic everywhere.

• Edited by Friday, December 7, 2012 3:28 AM
Friday, December 7, 2012 3:24 AM

• The problem I see is I do not see the caluculations of the 12 months of rainfall with the code I posted above I only see enter the rainfall for Jan-Dec. I guess I am not undersatnding the assignment fully.
Your code is right.  (simple)  I added some code and explanation. (underline)
M = "1=Jan;2=Feb;3=Mar;4=Apr;5=May;6=June;7=July;8=Aug;9=Sep;10=Oct;11=Nov;12=Dec"  '  Month name array
For i = 1 To 12
TextWindow.Write("Enter the RainFall For " + M[i] + " :")     ' question
RF[i] = TextWindow.Read()                                     ' enter rainfall value
EndFor
TextWindow.WriteLine("  ")
For i = 1 To 12
TextWindow.WriteLine(M[i]+" rainfall is .... "+RF[i])         '  show  month's  rainfall value
Total = Total + RF[i]
EndFor
TextWindow.WriteLine("  ")
TextWindow.WriteLine(" Total rainfall is .... "+Total)          ' show total  rainfall value
Average = Total / 12
If Average > 10 Then
TextWindow.WriteLine("Too Much Rain,The Average Is " + Average) '  show message and average value
EndIf
Friday, December 7, 2012 6:49 AM

### All replies

• M = "1=Jan;2=Feb;3=Mar;4=Apr;5=May;6=June;7=July;8=Aug;9=Sep;10=Oct;11=Nov;12=Dec"

For i = 1 To 12

TextWindow.Write("Enter the RainFall For " + M[i] + " :")

EndFor

For i = 1 To 12

Total = Total + RF[i]

EndFor

Average = Total / 12

If Average > 10 Then

TextWindow.WriteLine("Too Much Rain,The Average Is " + Average)

EndIf

This is what I have so far for my assignment following the above instructions but it does not seem correct and I am not understanding what I am missing if someone with Small basic knowledge can help that woud be great. Thank you in advance.

Friday, December 7, 2012 3:30 AM
• Problem is -> we don't know what is not correct either!

You have to tell us what is amiss!

Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

Friday, December 7, 2012 4:35 AM
• The problem I see is I do not see the caluculations of the 12 months of rainfall with the code I posted above I only see enter the rainfall for Jan-Dec. I guess I am not undersatnding the assignment fully.
Friday, December 7, 2012 4:39 AM
• The problem I see is I do not see the caluculations of the 12 months of rainfall with the code I posted above I only see enter the rainfall for Jan-Dec. I guess I am not undersatnding the assignment fully.
Your code is right.  (simple)  I added some code and explanation. (underline)
M = "1=Jan;2=Feb;3=Mar;4=Apr;5=May;6=June;7=July;8=Aug;9=Sep;10=Oct;11=Nov;12=Dec"  '  Month name array
For i = 1 To 12
TextWindow.Write("Enter the RainFall For " + M[i] + " :")     ' question
RF[i] = TextWindow.Read()                                     ' enter rainfall value
EndFor
TextWindow.WriteLine("  ")
For i = 1 To 12
TextWindow.WriteLine(M[i]+" rainfall is .... "+RF[i])         '  show  month's  rainfall value
Total = Total + RF[i]
EndFor
TextWindow.WriteLine("  ")
TextWindow.WriteLine(" Total rainfall is .... "+Total)          ' show total  rainfall value
Average = Total / 12
If Average > 10 Then
TextWindow.WriteLine("Too Much Rain,The Average Is " + Average) '  show message and average value
EndIf
Friday, December 7, 2012 6:49 AM