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):

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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

### Java Code for Wind Chill Calculation

This Java program is designed to calculate the wind chill factor based on the temperature and wind speed provided by the user. Below is a transcription and explanation of the program components:

#### Code Explanation

```java
/**
 * 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\tWindSpeed\tWind Chill Factor\tFeels Like");
        System.out.println("----------------------------------------------------");
        for (int i = 1; i <= windSpeed; i++) {
            double chillFactor = wcfactor(temp, i);
            System.out.printf("%5d F %7d MPH%18.2f\n", t, i, chillFactor, Math.round(chillFactor));
        }
    }
}
// end of Project 2
```

### Key Components

- **getVelocity Method**:
  - Ensures the wind speed provided by the user is between 2 and 50 MPH.

- **wcfactor Method**:
  - Calculates the wind chill factor using the formula:
    \[
    WCF = 35.74 + 0.6215 \times T - 35.75 \times V^{0.16} + 0.4275 \times T \times V^{0.16}
    \]
  - Where T is the temperature in Fahrenheit, and V is the wind speed in MPH.

- **Main Method**:
  - Takes user
Transcribed Image Text:### Java Code for Wind Chill Calculation This Java program is designed to calculate the wind chill factor based on the temperature and wind speed provided by the user. Below is a transcription and explanation of the program components: #### Code Explanation ```java /** * 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\tWindSpeed\tWind Chill Factor\tFeels Like"); System.out.println("----------------------------------------------------"); for (int i = 1; i <= windSpeed; i++) { double chillFactor = wcfactor(temp, i); System.out.printf("%5d F %7d MPH%18.2f\n", t, i, chillFactor, Math.round(chillFactor)); } } } // end of Project 2 ``` ### Key Components - **getVelocity Method**: - Ensures the wind speed provided by the user is between 2 and 50 MPH. - **wcfactor Method**: - Calculates the wind chill factor using the formula: \[ WCF = 35.74 + 0.6215 \times T - 35.75 \times V^{0.16} + 0.4275 \times T \times V^{0.16} \] - Where T is the temperature in Fahrenheit, and V is the wind speed in MPH. - **Main Method**: - Takes user
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education