'This program takes climate data for 1o cities, determines the totals & writes the results.
'Import ID:KQN133-0. Coded by: Jibba Jabba , on July 4, 2014.
'****************************************************************************************
'REQUEST USER INPUT, READ IT & DETERMINE TOTALS AFTER EACH CITY IS ENTERED
For i = 1 To 10
TextWindow.WriteLine("Please enter your data for 10 cities as prompted.")
TextWindow.WriteLine("City number: " + i)
TextWindow.WriteLine("-------------------------------------------------")
TextWindow.Write("Temperature (a number in degrees Celcius): ")
cityTemperature = TextWindow.ReadNumber()
TextWindow.Write("Is it Raining? (y/n): ")
isCityRaining = TextWindow.Read()
TextWindow.Write("Is it Windy? (y/n): ")
isCityWindy = TextWindow.Read()
DetermineTotals()
'PROMPT THE USER TO ENTER DATA FOR THE NEXT CITY
If i < 10 Then
TextWindow.WriteLine("-------------------------------------------------")
TextWindow.WriteLine("Press any key to enter next city.")
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
EndIf
EndFor
'THANK THE USER FOR THEIR DATA AND PROMPT THEM TO DISPLAY THE RESULTS
TextWindow.WriteLine("-------------------------------------------------")
TextWindow.WriteLine("Thanks! You've entered data for 10 Cities.")
TextWindow.WriteLine("Press any key to see the results.")
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
'==============================================================
'Subroutine/s
'==============================================================
'CALL THIS SUB TO DETERMINE TOTALS AFTER DATA IS ENTERED FOR EACH CITY
Sub DetermineTotals
If cityTemperature < 10 Then
totalColdCities = totalColdCities + 1
ElseIf cityTemperature < 18 Then
totalCoolCities = totalCoolCities + 1
ElseIf cityTemperature < 28 Then
totalWarmCities = totalWarmCities + 1
Else
totalHotCities = totalHotCities + 1
EndIf
If isCityRaining = "y" Or isCityRaining = "Y" Then
totalRainyCities = totalRainyCities + 1
EndIf
If isCityWindy = "y" Or isCityRaining = "Y" Then
totalWindyCities = totalWindyCities + 1
EndIf
EndSub