vikramkumaar / Java_Projects

2 stars 0 forks source link

Java Programming: Solving Problems with Software #Week_3 #1

Open vikramkumaar opened 3 years ago

vikramkumaar commented 3 years ago

++++++++++++++++++++++++++++ CSV Files and Basic Statistics in Java

Question 1 If cr is a CSVRecord from one of the weather data files, which one of the following is a correct way to add a temperature from the file to an accumulating double variable named total?

a) total += cr.get(Double.parseDouble(“TemperatureF”)); b) total += cr.get(“TemperatureF”); c) double temp = cr.get(“TemperatureF”); total += Double.parseDouble(temp); d) double temp = Double.parseDouble(cr.get(“TemperatureF”)); total += temp;

Question 2 Suppose the name of the file that has the coldest temperature is obtained with this line of code: filenameWithColdestTemp = something.getName(); Which one of the following must be true about something?

a) something must be of type File b) something must be of type DirectoryResource c) something must be of type CSVRecord d) something must be of type CSVParser

Question 3 Questions 3–9 refer to weather data that can be downloaded in a .zip by clicking here. Run your program on weather data from May 1, 2014, in the file weather-2014-05-01.csv. What was the coldest temperature on this day?

Question 4 Run your program on the data files for the year 2014. What was the coldest temperature in this year?

Question 5 Run your program on weather data from April 1, 2014 in the file weather-2014-04-01.csv. At what time of day did the lowest humidity occur (from the DateUTC column)?

11:51:00

13:51:00

16:51:00

18:51:00

20:51:00

Question 6 Run your program on weather data from 2014. What was the lowest humidity in that year?

Question 7 Run your program on weather data from 2014. At what time of day did the lowest humidity in that year occur?

11:51:00

13:51:00

16:51:00

18:51:00

20:51:00

Question 8 Run your program on weather data from June 1, 2014 in file weather-2014-06-01.csv. What was the average temperature on this day? (Give your answer to four decimal places, and truncate the rest. For example, if the average temperature was 989.777874, you would enter 989.7778 as your answer.)

Question 9 Run your program on weather data from March 30, 2014 in file weather-2014-03-30.csv. What was the average temperature in Fahrenheit for those temperature readings when the humidity is greater than or equal to 80? (Give your answer to three decimal places, and truncate the rest. For example, if the average temperature was 989.777874, you would enter 989.777 as your answer.)

vikramkumaar commented 3 years ago

1: double temp = Double.parseDouble(cr.get(“TemperatureF”)); total += temp; 2: something must be of type File 3: 4: 5: 18:51:00 6: 7: 18:51:00 8: 9: