Given a certain temperature in Fahrenheit and a maximum wind velocity (speed) in Miles Per Hour, calculate and display a series of wind chill factors from a wind velocity of 1 MPH to the maximum wind velocity in a table. The user is allowed to specify a maximum wind velocity of up to 50 MPH. Create a project and class in BlueJ named Project2. In main(), your program should prompt the user to enter the current temperature and use a Scanner object to store it in a double variable. Then the user should be prompted to enter the maximum wind velocity and use the Scanner object to store it in an integer variable. If the maximum wind velocity is greater than 1 AND less than or equal to 50, do the following: • Display the first line of the table with column headers for the current temperature, the wind velocity (speed), the calculated wind chill factor, and what the temperature actually feels like. You will need to use the \t escape sequence to put spacing between the columns. • Within a for loop, call a method named wcfactor that has a double parameter and an integer parameter. The method will return a double value for the wind chill factor, based on the following formula (T is the temperature, V is the wind velocity): o ?? = 35.74 + 0.6215 ∗ ?? − 35.75 ∗ ??0.16 + 0.4275 ∗ ?? ∗ ??0.16 • Display each line of the table using a System.out.printf statement. The data should be in this order: current temp, wind speed, calculated wind chill factor, and what the temperature actually feels like. Each line of data must do the following: o The current temp must be converted to an integer using casting so that no decimal places are displayed. o The calculated wind chill factor must be rounded to 2 decimal places. o The Math.round() method must be used to display what the temperature actually feel like with no decimal places. o You must use field widths for each of the four data items to make each data item appear near the middle of each column. You are not allowed to use any escape characters for any of the four data items. Refer to the sample output document in the Files area of Canvas for an example. Otherwise (maximum wind speed is less than or equal to 1 OR greater than 50), display an error message saying “Invalid max wind

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter4: Making Decisions
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question

Given a certain temperature in Fahrenheit and a maximum wind velocity
(speed) in Miles Per Hour, calculate and display a series of wind chill
factors from a wind velocity of 1 MPH to the maximum wind velocity in a
table. The user is allowed to specify a maximum wind velocity of up to 50
MPH.
Create a project and class in BlueJ named Project2.
In main(), your program should prompt the user to enter the current
temperature and use a Scanner object to store it in a double variable. Then
the user should be prompted to enter the maximum wind velocity and use
the Scanner object to store it in an integer variable.
If the maximum wind velocity is greater than 1 AND less than or equal to
50, do the following:
• Display the first line of the table with column headers for the current
temperature, the wind velocity (speed), the calculated wind chill
factor, and what the temperature actually feels like. You will need to
use the \t escape sequence to put spacing between the columns.
• Within a for loop, call a method named wcfactor that has a double
parameter and an integer parameter. The method will return a double
value for the wind chill factor, based on the following formula (T is the
temperature, V is the wind velocity):
o ?? = 35.74 + 0.6215 ∗ ?? − 35.75 ∗ ??0.16 + 0.4275 ∗ ?? ∗ ??0.16
• Display each line of the table using a System.out.printf statement.
The data should be in this order: current temp, wind speed,
calculated wind chill factor, and what the temperature actually feels
like. Each line of data must do the following:
o The current temp must be converted to an integer using casting
so that no decimal places are displayed.
o The calculated wind chill factor must be rounded to 2 decimal
places.
o The Math.round() method must be used to display what the
temperature actually feel like with no decimal places.
o You must use field widths for each of the four data items to
make each data item appear near the middle of each column.
You are not allowed to use any escape characters for any
of the four data items. Refer to the sample output document in
the Files area of Canvas for an example.
Otherwise (maximum wind speed is less than or equal to 1 OR greater than
50), display an error message saying “Invalid max wind speed”.
You must have the code header contained in the
CS21CommentHeader.docx file at the beginning of your code. Please fill
out the header with the proper information and remove all text in
parentheses.

Assume the starting temp is 5 degrees and the maximum wind speed is 25 MPH. Here
is how the output should look:
Enter starting temperature(F):
5
Enter maximum wind speed (MPH) :
25
Current Temp
Wind Speed
Wind Chill Factor
Feels Like
5 F
5 F
5 F
1 MPH
5.24
5 F
2 MPH
1.29
1 F
З МРН
-1.22
-1 F
5 F
4 MPH
-3.11
-3 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 MPH
-4.64
-5 F
6 MPH
-5.92
-6 F
7 MPH
8 MPH
9 MPH
-7.04
-7 F
-8.03
-8 F
-8.93
-9 F
10 MPH
-9.74
-10 F
11 MPH
-10.48
-10 F
5 F
12 MPH
-11.18
-11 F
5 F
5 F
13 MPH
-11.82
-12 F
14 MPH
-12.42
-12 F
5 F
15 MPH
-12.99
-13 F
5 F
16 MPH
-13.53
-14 F
5 F
17 MPH
-14.04
-14 F
5 F
18 MPH
-14.53
-15 F
5 F
5 F
19 MPH
-14.99
-15 F
20 MPH
-15.44
-15 F
5 F
21 MPH
-15.86
-16 F
5 F
5 F
5 F
5 F
22 MPH
-16.27
-16 F
23 MРH
-16.66
-17 F
24 MPH
-17.04
-17 F
25 MPH
-17.41
-17 F
Transcribed Image Text:Assume the starting temp is 5 degrees and the maximum wind speed is 25 MPH. Here is how the output should look: Enter starting temperature(F): 5 Enter maximum wind speed (MPH) : 25 Current Temp Wind Speed Wind Chill Factor Feels Like 5 F 5 F 5 F 1 MPH 5.24 5 F 2 MPH 1.29 1 F З МРН -1.22 -1 F 5 F 4 MPH -3.11 -3 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 MPH -4.64 -5 F 6 MPH -5.92 -6 F 7 MPH 8 MPH 9 MPH -7.04 -7 F -8.03 -8 F -8.93 -9 F 10 MPH -9.74 -10 F 11 MPH -10.48 -10 F 5 F 12 MPH -11.18 -11 F 5 F 5 F 13 MPH -11.82 -12 F 14 MPH -12.42 -12 F 5 F 15 MPH -12.99 -13 F 5 F 16 MPH -13.53 -14 F 5 F 17 MPH -14.04 -14 F 5 F 18 MPH -14.53 -15 F 5 F 5 F 19 MPH -14.99 -15 F 20 MPH -15.44 -15 F 5 F 21 MPH -15.86 -16 F 5 F 5 F 5 F 5 F 22 MPH -16.27 -16 F 23 MРH -16.66 -17 F 24 MPH -17.04 -17 F 25 MPH -17.41 -17 F
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage