Question
Exercise 1 Build a program (application) in Java, which creates a single dimensional array with 31 elements, which will store the temperatures during the month
Exercise 1
Build a program (application) in Java, which creates a single dimensional array with 31 elements, which will store the temperatures during the month of January, in degrees Celsius.
Build the following functions and call them at the main method of this application.
1. Build the function that fills the vector with data entered during execution through dialog boxes.
/ * @return (returns) the array filled with data entered by the user * /
public int [] fillArray ()
}
2. Build a method that calculates the average temperature of the month and displays the days that have a temperature lower than the average temperature.
/ * @param int [] temp - the array that holds the temperatures of the month * / public void tempBelowAverage (int [] temp) }
3. To build the function that calculates the minimum temperature during the month of January.
/ * @param int [] temp - the array that stores the temperatures of the month
* @return (returns) the minimum temperature
* /
public int tempMinimal (int [] temp)
}
4. To build the method that displays how many days of the month have temperatures equal to a given temperature. / * @param int [] temp - the array that holds the temperatures of the month * @param valueTemp - specific temperature required in the array* / public void (int [] temp, int valueT) } 5. Build the method that displays the temperatures of January in descending order.
/ * @param int [] temp - array that holds the temperatures of the month * / public void orderArray (int [] temp) }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started