This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

1. Create a class encapsulating the concept of daily temperatures for a week. Prompt the user for 7 values; store the values in an array.

This class must include the following methods to manage the array: Accessors, mutators, toString and equals methods

Method to calculate number of days below freezing Method to determine and return largest temperature change between any 2 consecutive days

2.Write a client class to create objects from the class in step 1. In the client class main, you need to create a second array using an initializer list containing the following data: 32, 45, 52, 66, 76, 53, 31

Write the following method calls in your main:

A. Call the method to calculate the number of days below and freezing for each of the arrays. B. Use the equals method to compare the 2 arrays. C. Call the method that determines and returns the largest temperature change for each of the arrays. D. Use the toString method to print out each of the arrays.

public int [] getTempWeather() { int [] temp = new int [tempWeather.length]; for (int i = 0; i < tempWeather.length; i++) { temp[i] = tempWeather[i]; } return temp; }

//---------------------------------- //Method to calculate freezing temps //----------------------------------

public int getFreezing() { int temp = 0;

for (int i=0; i<tempWeather.length; i++) { if ((tempWeather[i] < 32) || (tempWeather[i] == 32)) temp++; } return temp; }

//--------------------------------------- //Method to calculate largest temp change //---------------------------------------

public int getMaxChange() { int i = 0; int max = tempWeather[0]; int temp = Math.abs(tempWeather[i]-tempWeather[i+1]);

for (i=1; i<tempWeather.length-2; i++) { if (temp > max) max = temp; } return max; }

I need help writing this program. I know for fact that my toString method is incorrect. If anyone could let me know what I've done wrong so far or what I've done right or guide me with the correct path I should take to finish this- anything at all really, I would greatly appreciate it! I've been trying to find the solution or anything that will help, but I haven't been too successful.