Answered step by step
Verified Expert Solution
Question
1 Approved Answer
xercise # 2 ( 5 0 points ) : Design and implement a Java class, named DailyTemps ( in file DailyTemps.java ) , that implements
xercise # 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 onedimensional array of size elements to store the daily temperatures. If you use an array, the assumption is that array index represents Monday's temperature; array index 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 resetting 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 for the week. In the test program, use proper output label, such as "Number of freezing days is 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:
tableMondayTuesdayWednesdayThursday
Write a test program, named TestTemps in file TestTemps.java to test all class methods on at least one
Page
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