Wind Chill Factor Calculation Project: IS187, University of Alaska

Verified

Added on  2019/09/16

|3
|255
|498
Project
AI Summary
This project requires the creation of an interactive program designed to calculate the wind chill factor, a crucial element in understanding the impact of weather conditions, particularly in regions like Alaska. The program should accept user input for temperature (between -20F and 15F) and wind velocity (between 5 mph and 30 mph), using multiples of five. The program reads a temperature file into a two-dimensional array named windchilltbl. It then prompts the user for temperature and wind velocity and uses a pre-defined wind chill factor table (also provided in text format) to determine and display the resulting wind chill factor. The project's goal is to simulate the effects of wind on perceived temperature, emphasizing the relationship between wind speed, actual temperature, and the potential for frostbite, as well as the importance of these calculations in environmental science and meteorology.
Document Page
IS187-PROJECT 4
Name _________________
As every resident of Alaska knows, the real enemy in terms of the weather is not the near-zero temperatures, but the
wind-chill factor. Meteorologists in Alaska and in many other states give both the temperature and the wind-chill factor. So
important is the wind-chill factor that claim air at -40 Fahrenheit is less likely to cause frostbite than air just below freezing
that is blowing at gale force. Basically, two factors determine the wind-chill factor: the velocity of wind and the
temperature.
a. Design an interactive program that accepts from the user a temperature between -20F and 15F and a wind velocity
between 5 mph and 30 mph, both in multiples of five. The program should read the temperature.txt file provided to you by
your instructor into an array table named windchilltbl – a two dimensional array table. The program prompts the user to
enter a temperature between -20F and 15F and a wind velocity between 5 mph and 30 mph, both in multiples of five.
Finally, the program looks up the wind-chill factor table in a positional organized table and display the result. The following
is the wind chill factor table, which is also provided in a text file format.
Temperature
In Fahrenheit
Wind Velocity in Miles per Hour
5 10 15 20 25 30
-20 -26 -46 -58 -67 -74 -79
-15 -21 -40 -51 -60 -66 -71
-10 -15 -34 -45 -53 -59 -64
-5 -10 -27 -38 -46 -51 -56
0 -5 -22 -31 -39 -44 -49
5 0 -15 -25 -31 -36 -41
10 7 -9 -18 -24 -29 -33
15 12 -3 -11 -17 -22 -25
b. Create code in Java for the same problem. Demonstrate your Java program at run time by capturing runtime screen
shots. You may use the following code to read the temperature.txt file.
package project_4;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Project_4 {
public static void main(String[] args) throws FileNotFoundException {
// declare a two dimensional array named windchilltbl
int [][] windchilltbl=new int[8][6];
// declare temperature, velocity, xpos and ypos for the array indexes
int temp,vel,xpos,ypos;
//declare Scanner variable for console input
Scanner scan=new Scanner(System.in);
//declare reader to read temperature.txt. You may need to change the file path
Scanner reader=new Scanner(new File("C:\\Users\\BA202\\Desktop\\temperature.txt"));
//read temperature.txt file and fill the array elements table
for (int i=0;i<8;i++){
for (int j=0;j<6;j++){
windchilltbl[i][j]=reader.nextInt();
System.out.print(windchilltbl[i][j]+"\t");
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
}
System.out.println();
}
//prompt user to enter temperature. Read and validate input
//prompt user to enter velocity. Read and validate input
//calc row index and col index
//display windchill factor
}
}
--test the array table
--test the wind chill factor display
Document Page
c. Use the following sample data to test your program. Capture runtime screen shots.
Temperature (F) Wind Velocity (mph)
-15 10
5 30
-5 40
-40 25
15 10
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]