For this project, you are to complete the following assignment: 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. Here are the programming instructions for this project: • You must use coding techniques from only Chapter 1 through Section 5.1 in our textbook. You may not use any other coding techniques from any other sources. • Create a project and class in BlueJ named Project2 • In main(), do the following: o Prompt the user to enter the current temperature and use a Scanner object to store it in a double variable. o Call a method named getVelocity that returns an integer and has a Scanner parameter. This method must use a either a while loop or a do-while loop to prompt the user to enter the maximum wind velocity (speed) and return it. A valid value for the maximum wind velocity is between 2 and 50 (inclusive). As long as the value is not valid, display a message saying the value is invalid and prompt the user to enter the value again. The condition for this loop must contain a Boolean expression with relational operators (one or more of these: <, >, <=, >=, ==, !=, &&, !!). o 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. o Within a for loop, call a method named wcfactor that returns a double and has a double parameter and an integer parameter. The method will return a value for the wind chill factor, based on the following formula (T is the temperature, V is the wind velocity):

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter1: Getting Started With Excel
Section: Chapter Questions
Problem 1.9CP
icon
Related questions
Question
100%
For this project, you are to complete the following assignment:

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.

Here are the programming instructions for this project:

• You must use coding techniques from only Chapter 1 through Section 5.1 in our textbook. You may not use any other coding techniques from any other sources.
• Create a project and class in BlueJ named Project2
• In main(), do the following:
o Prompt the user to enter the current temperature and use a Scanner object to store it in a double variable.
o Call a method named getVelocity that returns an integer and has a Scanner parameter. This method must use a either a while loop or a do-while loop to prompt the user to enter the maximum wind velocity (speed) and return it. A valid value for the maximum wind velocity is between 2 and 50 (inclusive). As long as the value is not valid, display a message saying the value is invalid and prompt the user to enter the value again.
The condition for this loop must contain a Boolean expression with relational operators (one or more of these:
<, >, <=, >=, ==, !=, &&, !!).
o 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.
o Within a for loop, call a method named wcfactor that returns a double and has a double parameter and an integer parameter. The method will return a value for the wind chill factor, based on the following formula (T is the temperature, V is the wind velocity):
W = 35.74 + 0.6215 * T - 35.75 * V^0.16 + 0.4275 * T * V^0.16
o 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:
 The current temp must be converted to an integer using casting so that no decimal places are displayed.
 The calculated wind chill factor must be rounded to 2 decimal places.
 The Math.round() method must be used to display what the temperature actually feels like with no decimal places.
 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.
Enter starting temperature (F):
5
Enter maximum wind speed (MPH) :
25
Current Temp
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
5 F
Wind Speed
1 MPH
2 MPH
3 MPH
4 MPH
5 MPH
6 MPH
7 MPH
8 MPH
9 MPH
10 MPH
11 MPH
12 MPH
13 MPH
14 MPH
15 MPH
16 MPH
17 MPH
18 MPH
19 MPH
20 MPH
21 MPH
22 MPH
23 MPH
24 MPH
25 MPH
Wind Chill Factor
5.24
1.29
-1.22
-3.11
-4.64
-5.92
-7.04
-8.03
-8.93
-9.74
-10.48
-11.18
-11.82
-12.42
-12.99
-13.53
-14.04
-14.53
-14.99
-15.44
-15.86
-16.27
-16.66
-17.04
-17.41
Feels Like
5 F
1 F
-1 F
-3 F
-5 F
-6 F
-7 F
-8 F
-9 F
-10 F
-10 F
-11 F
-12 F
-12 F
-13 F
-14 F
-14 F
-15 F
-15 F
-15 F
-16 F
-16 F
-17 F
-17 F
-17 F
Transcribed Image Text:Enter starting temperature (F): 5 Enter maximum wind speed (MPH) : 25 Current Temp 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F 5 F Wind Speed 1 MPH 2 MPH 3 MPH 4 MPH 5 MPH 6 MPH 7 MPH 8 MPH 9 MPH 10 MPH 11 MPH 12 MPH 13 MPH 14 MPH 15 MPH 16 MPH 17 MPH 18 MPH 19 MPH 20 MPH 21 MPH 22 MPH 23 MPH 24 MPH 25 MPH Wind Chill Factor 5.24 1.29 -1.22 -3.11 -4.64 -5.92 -7.04 -8.03 -8.93 -9.74 -10.48 -11.18 -11.82 -12.42 -12.99 -13.53 -14.04 -14.53 -14.99 -15.44 -15.86 -16.27 -16.66 -17.04 -17.41 Feels Like 5 F 1 F -1 F -3 F -5 F -6 F -7 F -8 F -9 F -10 F -10 F -11 F -12 F -12 F -13 F -14 F -14 F -15 F -15 F -15 F -16 F -16 F -17 F -17 F -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
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I seem to have an error at System.out.printf

/**
* Write a description of class Project2 here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util. *;
public class Project2
public static int getVelocity (Scanner sc) {
int vel;
do {
}
vel
sc.nextInt ();
} while (vel < 2 || vel > 50);
return vel;
public static double wcfactor (double T, int V) {
return 35.74 +0.6215 * T - 35.75 * Math.pow(V, 0.16) + 0.4275 * T * Math.pow(V, 0.16);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter starting temperature (F): ");
double temp = sc.nextDouble();
System.out.println("Enter maximum wind speed (MPH): ");
int windSpeed = getVelocity (sc);
int t= (int) (temp);
System.out.println("Curent Temp\t\tWindSpeed\t\tWind Chill Factor\t\tFeels Like");
System.out.println("
for (int i = 1; i < windSpeed; i++) {
");
double chillFactor= wcfactor (temp, i);
System.out.printf("%5d F%17d MPH% 18.2%18d F\n",t, i, chillFactor, Math.round (chillFactor));
}
}// end of Project 2
BlueJ: Terminal Window - Project2
Options
Enter starting temperature (F):
5
Enter maximum wind speed (MPH) :
5
Curent Temp
WindSpeed
Wind Chill Factor
< (
Can only enter input while your program is running
java.util. Illegal Format Precision Exception: 2
Feels Like
at java.base/java.util. Formatter$Format Specifier.checkText (Formatter.java:3186)
at java.base/java.util.Formatter$Format Specifier.<init>(Formatter.java:2878)
at java.base/java.util. Formatter
at java.base/java.util. Formatter.format(Formatter.java:2655)
at java.base/java.io.PrintStream. format (PrintStream.java:1053)
at java.base/java.io.PrintStream.printf (PrintStream.java:949)
at Project2.main(Project2.java:34)
se (Formatter.java:2713)
>
Transcribed Image Text:/** * Write a description of class Project2 here. * * @author (your name) * @version (a version number or a date) */ import java.util. *; public class Project2 public static int getVelocity (Scanner sc) { int vel; do { } vel sc.nextInt (); } while (vel < 2 || vel > 50); return vel; public static double wcfactor (double T, int V) { return 35.74 +0.6215 * T - 35.75 * Math.pow(V, 0.16) + 0.4275 * T * Math.pow(V, 0.16); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter starting temperature (F): "); double temp = sc.nextDouble(); System.out.println("Enter maximum wind speed (MPH): "); int windSpeed = getVelocity (sc); int t= (int) (temp); System.out.println("Curent Temp\t\tWindSpeed\t\tWind Chill Factor\t\tFeels Like"); System.out.println(" for (int i = 1; i < windSpeed; i++) { "); double chillFactor= wcfactor (temp, i); System.out.printf("%5d F%17d MPH% 18.2%18d F\n",t, i, chillFactor, Math.round (chillFactor)); } }// end of Project 2 BlueJ: Terminal Window - Project2 Options Enter starting temperature (F): 5 Enter maximum wind speed (MPH) : 5 Curent Temp WindSpeed Wind Chill Factor < ( Can only enter input while your program is running java.util. Illegal Format Precision Exception: 2 Feels Like at java.base/java.util. Formatter$Format Specifier.checkText (Formatter.java:3186) at java.base/java.util.Formatter$Format Specifier.<init>(Formatter.java:2878) at java.base/java.util. Formatter at java.base/java.util. Formatter.format(Formatter.java:2655) at java.base/java.io.PrintStream. format (PrintStream.java:1053) at java.base/java.io.PrintStream.printf (PrintStream.java:949) at Project2.main(Project2.java:34) se (Formatter.java:2713) >
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Concept of Parenthesis
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage