New York City temperature ranges for 12 months are given below:
Jan Feb Mar Apr May JunJul Aug Sep Oct Nov Dec
25–38 26-40 34-4843-58 52-68 62-7768-83 60-75 49-65 41-54 31-43 47-61
1. Create an int array of size 366 to save the daily temperatures for a leap year.
2. Fill the array with randomly generated numbers between the ranges for that month. For example, for the first 31 days of the year (that is the month of January) randomly generate numbers between 25 and 38. For the next 29 days (the Month of February) randomly generate numbers between 26 and 40, and so on for every month.
The formula for generating random numbers between two numbers m and n is,
(int)Math.floor(m + Math.random() * (n-m+1));
Or you may choose to use the Random Class from the util package.
3. Print the average temperature for each month.
4. Print the hottest day for the entire year, in the following format:
Example: The hottest day was Thursday, July 4. Also, mention what the temperature
Was on this day.
You may assume that January 1 was a Monday.
5. Print the coldest day for the entire year, in the following format:
Example: The coldest day was Tuesday, February 12. Also, mention what the
temperature was on this day. Again, assume that January 1 was a Monday.
6. How many days in the year was it below 330 F and how many more than 750F.
So far i Have this
import java.util.Random;
public class NYCTemp
{
String [] days = {"Sunday","Monday","Tuesday","Wednesday","Thursday ","Friday","Saturday"};
String [] months = {"January","February","March","April","May","June" ,"July","August","September","October","November", "December"};
int [] daysInMonth = {31,29,31,30,31,31,30,31,30,31,30,31};