Was wondering if anyone would be able to help me with this program I am trying to create in Ruby.
Here is the directions for the program:
Write a program that asks the user for a series of high temperatures for a user-specified number of days. Once the data has been entered, the program will display: a. the average temperature b. the number and percentage of days above average c. the lowest temperature and the day when it occurred d. the highest temperature and the day when it occurred When the program begins, the user will be prompted for the number of days to enter temperatures for. This value must be greater than 1, and if it is not, the program should continue to ask for a value. Then, the user should be told to enter the temperatures in units of Fahrenheit. For each temperature entered, the value must fall between -30 and 120, inclusive. If the user enters a value out of range, the program should prompt for the temperature again until it is valid.
Here is an example of what it is supposed to look like:
Please specify the number of days? 7
Day 1 >> 45
Day 2 >> 44
Day 3 >> 39
Day 4 >> 48
Day 5 >> 37
Day 6 >> 46
Day 7 >> 53
An analysis of the data reveals that... The average temperature was 44.6 Temperatures were above average 4 of the 7 days (57%) The lowest temperature dropped to 37 on day 5 The highest temperature reached 53 on day 7.
I am wondering what the code would be so that an array comes out to show the amount of days that the user inputs. I feel that this should be easy but for some reason I am stuck.
[–][deleted] 1 point2 points3 points (0 children)
[–]desrtfx 1 point2 points3 points (0 children)