在Ruby中创建空气污染指数阅读器(直截了当的问题)

问题描述 投票:0回答:1

我在这个问题上陷入了中途,我无法发布图片,因为我需要在这里获得10点声望。所以我从字面上重新创建了整个问题。没有给我文件,只是给这个问题的说明。从字面上看没有其他]

#**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

我在这个问题上陷入了中途,我无法发布图片,因为我需要在这里获得10点声望。所以我从字面上重新创建了整个问题。没有文件...

ruby
1个回答
0
投票

Range

© www.soinside.com 2019 - 2024. All rights reserved.