Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Go program that prompts the user to enter a temperature between -58F and 41F and a wind speed greater than or equal to

Write a Go program that prompts the user to enter a temperature between -58F and 41F and a wind speed greater than or equal to 2 then displays the wind-chill temperature. If the user enters an invalid number due it being out of range or not a number, prompt the user again until they enter a valid value. Output two digits past the decimal place (hundreths of F).

Add a flag to the program called "-table" that displays a table instead of prompting. The table should have the same bounds and format as the above table in the Overview section except that it should show the wind chill to the tenths place.

The formula is twc = 35.74 + 0.6215ta - 35.75v0.16 + 0.4275tav0.16

where ta is the outside temperature measured in degrees Fahrenheit, v is the speed measured in miles per hour, and twc is the wind-chill temperature. The formula cannot be used for wind speeds below 2 mph or temperatures below -58F or above 41F.image text in transcribed

$ go run windchill.go Enter the temperature in F:6.3 Enter the wind speed in miles per hour: 4 The wind chill index is 1.61F \$go run windchill.go Enter the temperature in F:92 92.000000 is out of range. Valid temperatures are between 58F and 41F. Enter the temperature in F:13 Enter the wind speed in miles per hour: 1 1.000000 is out of range. Valid wind speeds are above 2mph. Enter the wind speed in miles per hour: x strconv.ParseFloat: parsing "": invalid syntax Enter the wind speed in miles per hour: unexpected newline Enter the wind speed in miles per hour: 4 The wind chill index is 6.13F

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Calculate the lifetime value (LTV) of a loyal customer.

Answered: 1 week ago