Question: xercise # 2 ( 5 0 points ) : Design and implement a Java class, named DailyTemps ( in file DailyTemps.java ) , that implements

xercise #2(50 points): Design and implement a Java class, named DailyTemps (in file DailyTemps.java), that implements the concept of daily temperatures for a week. You have the option to use separate variables or one-dimensional array (of size 7 elements) to store the daily temperatures. If you use an array, the assumption is that array index 0 represents Monday's temperature; array index 1 represents. Tuesday's temperature; etc.
The class defines the following methods:
Constructor method receives the inputs (daily temperature values) from the test program. These values are passed as parameters. In the test program, use proper prompts for reading the user input values.
Method named setTemp (...) that allows re-setting the temperature for one day. The day is specified by its name (or by the array index of its position in the array). Use proper prompts for reading the inputs (day and temperature) from the user in the main program, then pass these parameters to the method.
Method named Freezing () that returns the number of days with temperature below freezing (under 32F) for the week. In the test program, use proper output label, such as "Number of freezing days is 3 days".
Method named Warmest () that returns the name of the warmest day in the week. If more than one day are warmest, return first warmest day name. In the test program, use proper output label, such as "The warmest day of the week is Tuesday".
Method named printTemps () to print out the temperatures for the week as follows: (This is sample output for format illustration purpose only. Make sure your outputs are formatted as shown):
\table[[Monday,57],[Tuesday,76],[Wednesday,81],[Thursday,65]]
Write a test program, named TestTemps (in file TestTemps.java), to test all class methods on at least one
Page 2
 xercise #2(50 points): Design and implement a Java class, named DailyTemps

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!