Skip to content

Instantly share code, notes, and snippets.

@landjd19
Created September 27, 2018 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save landjd19/52c1c1a1f789e615a0dbb1d2a7b0c3b8 to your computer and use it in GitHub Desktop.
Save landjd19/52c1c1a1f789e615a0dbb1d2a7b0c3b8 to your computer and use it in GitHub Desktop.
Rainfall
/**
* Rain fall measurements
*
* Jake Landaiche
* 9/26/18
*/
public class rainFall
{
public rainFall(){
double[] rain = {0,0.5,12,1.4,1.5,0,0.9,6.9,0.3,17.2,8.6,3.9,0.2,0,0,0.5,13.2,0.3,0,1.8,0,0,0.4,0,0.7,1.5,1.1,1.5,0.4,0.6,4.4,0.5,0.4,0,0.2,1.5,0,17.4,0.5,1.2,0.8,0,10.3,0.4,0,2.2,1.3,0,0,0,0,0,0,0,14.7,5.6,0,0,14.2,15.5,2.7,0,0,2.6,7.2,0,0,1.7,1.7,0,2,0.2,0,0.4,1,0.4,0,0.5,0,0,0,0.7,14.6,4.1,0.2,0,0,28.8,1.4,0,0,1.3,9.8,1.9,19,1.2,0,0,6.5,2.8,0.2,0,0,3.1,0,0,0,0.4,43.8,0.3,0,0,0,4.1,0,2.9,0,0,15.7,7.9,2.8,0.2,26.9,20,2.3,0,0.2,0,0,1.3,0,3,0.2,0,3.8,0,1,0,0,31.4,0,0,1.9,19.8,0.2,0,0.7,9.8,0,0,0,0,12.2,0,0.5,0,0,0,0,0,0,0,0,0,0,4.1,4.8,1.7,3.3,0,8.7,11.8,1.6,5.7,9.3,0.3,0,0.5,3.1,4.9,0,0,0,0,0,23.9,0,0,2.7,0,0,13.1,0,0,3.7,0,0,0,0.3,0,0.8,0,0,0,0,0,0,0,0.2,0,0,1,1.5,20.8,0.3,1.6,0,0,0,0,2,0,0,0,0,0,11.5,0.5,0,0,0,2.2,0,0.8,0.2,0,0,0,0,0,0,0,7,2.5,8.2,1.4,0.2,7.2,1.5,0,0,0,0,0,0,0,0,0,0,0.3,0,0,0,0,0,0,0,0,3.7,0,0,0,};
String dates = "1/4/17,1/5/17,1/6/17,1/7/17,1/8/17,1/9/17,1/10/17,1/11/17,1/12/17,1/13/17,1/14/17,1/15/17,1/16/17,1/17/17,1/18/17,1/19/17,1/20/17,1/21/17,1/22/17,1/23/17,1/24/17,1/25/17,1/26/17,1/27/17,1/28/17,1/29/17,1/30/17,1/31/17,2/1/17,2/2/17,2/3/17,2/4/17,2/5/17,2/6/17,2/7/17,2/8/17,2/9/17,2/10/17,2/11/17,2/12/17,2/13/17,2/14/17,2/15/17,2/16/17,2/17/17,2/18/17,2/19/17,2/20/17,2/21/17,2/22/17,2/23/17,2/24/17,2/25/17,2/26/17,2/27/17,2/28/17,3/1/17,3/2/17,3/3/17,3/4/17,3/5/17,3/6/17,3/7/17,3/8/17,3/9/17,3/10/17,3/11/17,3/12/17,3/13/17,3/14/17,3/15/17,3/16/17,3/17/17,3/18/17,3/19/17,3/20/17,3/21/17,3/22/17,3/23/17,3/24/17,3/25/17,3/26/17,3/27/17,3/28/17,3/29/17,3/30/17,3/31/17,4/1/17,4/2/17,4/3/17,4/4/17,4/5/17,4/6/17,4/7/17,4/8/17,4/9/17,4/10/17,4/11/17,4/12/17,4/13/17,4/14/17,4/15/17,4/16/17,4/17/17,4/18/17,4/19/17,4/20/17,4/21/17,4/22/17,4/23/17,4/24/17,4/25/17,4/26/17,4/27/17,4/28/17,4/29/17,4/30/17,5/1/17,5/2/17,5/3/17,5/4/17,5/5/17,5/6/17,5/7/17,5/8/17,5/9/17,5/10/17,5/11/17,5/12/17,5/13/17,5/14/17,5/15/17,5/16/17,5/17/17,5/18/17,5/19/17,5/20/17,5/21/17,5/22/17,5/23/17,5/24/17,5/25/17,5/26/17,5/27/17,5/28/17,5/29/17,5/30/17,5/31/17,6/1/17,6/2/17,6/3/17,6/4/17,6/5/17,6/6/17,6/7/17,6/8/17,6/9/17,6/10/17,6/11/17,6/12/17,6/13/17,6/14/17,6/15/17,6/16/17,6/17/17,6/18/17,6/19/17,6/20/17,6/21/17,6/22/17,6/23/17,6/24/17,6/25/17,6/26/17,6/27/17,6/28/17,6/29/17,6/30/17,7/1/17,7/2/17,7/3/17,7/4/17,7/5/17,7/6/17,7/7/17,7/8/17,7/9/17,7/10/17,7/11/17,7/12/17,7/13/17,7/14/17,7/15/17,7/16/17,7/17/17,7/18/17,7/19/17,7/20/17,7/21/17,7/22/17,7/23/17,7/24/17,7/25/17,7/26/17,7/27/17,7/28/17,7/29/17,7/30/17,7/31/17,8/1/17,8/2/17,8/3/17,8/4/17,8/5/17,8/6/17,8/7/17,8/8/17,8/9/17,8/10/17,8/11/17,8/12/17,8/13/17,8/14/17,8/15/17,8/16/17,8/17/17,8/18/17,8/19/17,8/20/17,8/21/17,8/22/17,8/23/17,8/24/17,8/25/17,8/26/17,8/27/17,8/28/17,8/29/17,8/30/17,8/31/17,9/1/17,9/2/17,9/3/17,9/4/17,9/5/17,9/6/17,9/7/17,9/8/17,9/9/17,9/10/17,9/11/17,9/12/17,9/13/17,9/14/17,9/15/17,9/16/17,9/17/17,9/18/17,9/19/17,9/20/17,9/21/17,9/22/17,9/23/17,9/24/17,9/25/17,9/26/17,9/27/17,9/28/17,9/29/17,9/30/17,10/1/17,10/2/17";
String [] datesArr = dates.split(",");
int noRain = 0;
double mostRain = rain[0];
for(int i = 0; i<rain.length; i++){
if (rain [i] == 0)
noRain++;
if (rain [i] > mostRain)
mostRain = rain [i];
}
System.out.println("Days without rainfall: " + noRain);
System.out.println("Most rain in one day: " + mostRain);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment