$29
For this assignment you are to complete the given Java source program, AS03.java, to that it prints a “table of wind chill values” over the range of temperatures as input by the user. The Wikipedia page at https://en.wikipedia.org/wiki/Wind_chill#/media/File:Wind_chill.png, presents an image that shows the NWS Windchill Chart; a table that shows the “wind chill values” for various temperatures (in Fahrenheit) and wind speeds (in MPH). Note that this page also provides the formula used to compute the wind chill values.
Consider the following dialogue that presents the execution of my solution program and showing the same values as presented in the chart cited above.
One apparent thing is that this program renders the table with the wind speeds (in MPH) as the column headings and the temperatures (in F) as the row entries. Thus, the output as produced by the program has transposed the rows and columns.
The main reason I have done this is so that program can produce specialized tables, for wind speeds over the interval
5.0 through 60.0 MPH in intervals of 5.0, for temperatures over given intervals.
Consider the following alternate executions of the same program.
In the first case, the temperature range is 10.0 through 20.0 in increments of 1.0. In the second case, the temperature range is 0.0 through 32.0 in increments of 8.0
P. M. Jackowitz Page 1 of 2
Once you are confident in your understanding of “what” this program is to do the specifics of “how” the program does the things it needs to do becomes the focus. The task to be performed may be decomposed into a few recognizable subtasks, each of which may be developed separately. Among these subtasks are the following:
• Implementing the given formula for Wind Chill as a Java expression inside a parameterized functional method. Given the crucial role this formula plays, the expression and method that contains it must be accurate. You may find it worthwhile to use methods from the Math class to perform some of the operations in this expression. (HINT: You may wish to develop a short focused “throw away” program that just tests this expression. Like the given TestPrintDouble.java)
• The control flow needed to produce a table requires a loop inside a loop (a.k.a. nested loops). The outer loop iterates over the rows (in this case that would be the temperatures). For each iteration of the outer loop there needs to be an inner loop to iterate over the columns (in this case that would be the wind speeds).
Each loop requires a “lower bound”, an “upper bound”, and a “loop control variable”. For example the inner loop’s lower bound is 5, upper bound is 60, and a loop control variable (appropriately named WindSpeed) that iterates from 5 to 60 in increments of 5.
• In order to maintain proper alignment of the table it will be necessary to control the width of each entry printed. The given printDouble method is useful in accomplishing this, and the given TestPrintDouble program is provided so you can see for yourself what this method does. You are expected to “copy and paste” the printDouble method as is into the program you develop.
• The “labeling” and “formatting” of the table (temperature values and wind speeds) needs additional consideration when printing the table since they are separate from the generation of the table entries themselves. (HINT: Develop an initial version of the program without the “labeling”, that just prints the “body” of the table. In this way you can initially focus on developing the body of the table, and then afterwards add the necessary statements to complete the table with its labeling rows and labeling columns.)
Although you may certainly declare and use additional methods in your revision of AS03.java, it is the intention of this assignment that you complete and use each of the “stubbed” methods already defined for you. What has been given is meant to guide you to a well-designed solution. Thus, the intention is that you will not modify the declarations of the given methods, but certainly you are expected to complete each of the stubbed methods so that they perform their intended tasks.
As usual you are to submit your final completed program, to be named AS03.java, to the AS03 folder on the CWS. Also as usual, this program is required to have the expected comment template with all of the entries completed appropriately. Additionally, you are welcome to also submit any “throw away” programs you have developed, but be sure to use the message area of the submission form to clarify which file is which. Please do not submit any files with the “.class” extension.
Good luck,
P.M.J.
P. M. Jackowitz Page 2 of 2