Question: In Java GUI format. This program will use snowfall data for Somerset, Kentucky from the year 1952 to 2016. The data will be stored in
In Java GUI format.
This program will use snowfall data for Somerset, Kentucky from the year 1952 to 2016. The data will be stored in four arrays, one will contain all of the above years (string data), the remaining three arrays will contain the snowfall data (doubles) for January, February, and March of each of the same years listed in the first array
Use good comments.
Think about the problem and decide what type each of the input numbers should be. Also, think about the calculations and decide what type the variables should be that will hold the results of the calculations.
Use camel casing for variable names, and use descriptive variable names. Do not use general variable names like "tax" or "total."
Use a drop-down box loaded with the years array to allow the user to select a year so that the program can look up the monthly snowfall amount for January, February, and March of the selected year.
The screen should display the following:
Below the drop-down box showing the user-selected year, display the snowfall for January, February, and March of that year.
Then display the total snowfall (for the three months) for the selected year.
Display the highest snowfall year of all the years (all three months combined).
Finally, display the average snowfall for all years (average of all three months combined).
Since some of these calculations will not change, regardless of which year the user selects, you have options as to when you will do those calculations. You may decide when to do those calculations.
Write methods for all tasks.
| The arrays are parallel in that each year in the years array will have a matching set of snowfall amounts in the January, February, and March arrays. That means that the index will be the same for the year and matching high and low temperature elements. Of course, all array indexes begin with zero. |
| Use an inner class for the listener. |
| You may modify the arrays in this program if that will facilitate your approach. You must, however, use arrays to solve the problem.
2.2. The Arrays String[] years = new { "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016" } int snowJan[] = new { 3.9, 0.0, 0.0, 2.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.3, 0.0, 2.0, 0.5, 7.2, 4.5, 8.5, 6.0, 1.0, 1.3, 0.3, 1.5, 0.0, 8.0,17.5, 0.0, 3.5, 1.0, 3.0, 3.3,30.5, 0.0, 0.0, 0.0, 4.6, 0.0, 1.8, 0.0, 2.5, 2.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 7.2, 1.1, 0.2, 0.3, 5.2, 2.0, 1.2, 0.4, 0.0,11.5, 9.9 }; int snowFeb[] = new { 0.0, 0.0, 0.0, 5.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.3, 0.0, 2.0, 0.5, 7.2, 4.5, 8.5, 6.0, 1.0, 1.3, 0.3, 1.5, 0.0, 8.0,17.5, 0.0, 3.5, 1.0, 3.0, 3.3,30.5, 0.0, 0.0, 0.0, 4.6, 0.0, 1.8, 0.0, 2.5, 2.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 7.2, 1.1, 0.2, 0.3, 5.2, 2.0, 1.2, 0.4, 0.0,11.5, 9.9 }; int snowMar[] = new { 2.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.5, 0.0, 0.6, 0.0, 0.0, 2.0, 0.0, 0.0, 0.6, 2.0, 0.5, 0.0, 0.0, 4.0, 0.0, 0.0, 4.0, 0.0, 2.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 1.7, 3.5, 2.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, 3.2, 0.3, 0.0, 0.0, 0.0, 1.3, 3.1, 4.0, 0.0 }; Make the layout logical and intuitive for the user.
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
