Final answer:
A class called Temperature is created to store daily temperatures for a week, with methods to handle temperature data, including finding below freezing and above 100-degree temperatures. A client class tests these functionalities.
Step-by-step explanation:
Implementing a Temperature Class
To encapsulate daily temperatures for a week, we create a class with a constructor that takes an array of seven temperatures. This class includes accessor and mutator methods for manipulating individual temperatures, a toString() method for a string representation of the temperatures, and an equals() method to compare two temperature objects. Additionally, we implement a method to count temperatures below freezing, a method to retrieve temperatures above 100 degrees, one to find the largest change in temperature between consecutive days, and a method to sort the temperatures in descending order. Finally, a separate client class is used to test all the methods.
Client Class for Testing
The client class includes a main method where instances of the temperature class are created using sample data. It then calls the methods within the temperature class to demonstrate functionality, such as retrieving sorted temperatures or finding changes in temperature.