Question
CIS 255 Java Programming Project 2: Methods The heat index is a measure of how hot the air feels based on a combination of air
CIS 255 Java Programming Project 2: Methods
The heat index is a measure of how hot the air feels based on a combination of air temperature and humidity. The National Oceanic and Atmospheric Administration has established a table of heat index values based on these combinations; however, scientists have also established a formula to approximate these table values for air temperatures 80F (T) and relative humidity values 40% (R): HI = -42.379 + 2.04901523T + 10.1433127R - 0.22475541TR - 6.8378310-3T 2 - 5.48171710-2R 2 + 1.2287410-3T 2R + 8.528210-4TR2 - 1.9910-6T 2R 2 Write a complete Java program in which the user enters an air temperature (degrees Fahrenheit, with or without a decimal point) and a relative humidity value (percentage form, with or without a decimal point). The program may use either the console or dialog boxes (but not both).
The program should send these values to a procedural, value-returning method that calculates and returns the heat index. If either the air temperature or the relative humidity cannot be used with this formula, the method should return a heat index of zero. The program should display an error message whenever the method returns zero; otherwise, it should display the result returned by this method with one digit after the decimal point. It should allow the user to repeat this calculation with new values using a loop (either sentinel-controlled or ask-before-iterating). You may word the prompts and the labels differently than shown in the example below, but your program must perform these specific actions (do not change the overall behavior of the program). The output should be appropriately formatted (spaces between words and values, separate lines to avoid words broken due to long lines wrapping in the console).
FILE NAME: FLast_Project2.java (including your first initial and last name where indicated)
POINTS: 12.5
Example Run (assume the user enters the values in bold at the end of each prompt):
Heat Index Calculator Enter the air temperature (degrees Fahrenheit) or enter -1 to exit: 84
Enter the humidity (as a percentage): 75
The heat index for that combination is 92.2 degrees Fahrenheit.
Enter the air temperature (degrees Fahrenheit) or enter -1 to exit: 70
Enter the humidity (as a percentage): 60 ERROR! Cannot calculate the heat index for temperatures below eighty degrees. or humidity values below forty percent.
Enter the air temperature (degrees Fahrenheit) or enter -1 to exit: 98.6
Enter the humidity (as a percentage): 42.5
The heat index for that combination is 108.1 degrees Fahrenheit. Enter the air temperature (degrees Fahrenheit) or enter -1 to exit: -1 Stay cool, man!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started