Find an Online Tutor Now

Hans Louis E.

asked • 10/22/19

Creating An Air Pollution Index Reader in Ruby (Straight Forward Question)


I got stuck halfway with this question, im unable to post the image because im required to get 10 reputation points here lol. So i literally recreated the whole question here. There were no files given to me, just the instructions for this question. Literally nothing else








**Range** then followed by **Category** :


#301-500 Hazardous


#201-300 Very Unhealthy


#151-200 Unhealthy


#101-150 Unhealthy for some


#51-100 Moderate


#0-50 Good




# Develop a ruby program according to the comments given below:

require ‘./input_functions’


# Write a function will prompt user to input the daily AQI reading for one week (7 days),

# it will display the category of each AQI input by user. This function will also find the

# highest AQI of the week and return it to the function caller



def read_aqi

# use a loop to get input for daily AQI reading

# call category() function and display the corresponding category

# find the highest AQI reading among the daily AQI reading

end



# Write a function that receives AQI reading as parameter. This function will determine the

# category (eg: Good, Moderate etc) of the air quality according to the value received by

# the parameter. The identified category (eg: Good, Moderate etc) is then assigned into a

# variable, and the value of this variable will be returned to the function caller.


def category ( )


end





def main

# declare needed variables or constants

# call read_aqi() function

puts “Highest AQI reading recorded for this week is “ +


puts “Highest AQI reading recorded for this week is at the level of ” + #call category()

end

main

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.