Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students explore these related Databases questions