ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

make changes to the existing code. take input in a function. In the interactive part, you will write the function toinputthe temperature then return…

by | Nov 28, 2023 | computer science

make changes to the existing code. take input a function. In the interactive part, you will write the to input the temperature  that temperature to the calling program.

  1. b) In lab 2A you were asked to do the following: Add a message based on the windchill. You decide the message. As an example, if the windchill is between 0 and 20 degrees or below you might say “brrrrrr…….that’s cold”; if it is between -1 and -20 you might say “Are we human flavored popsicles yet?”Move this whole code to a function. This function will need the temperature that you input. This function will also calculate the windchill and then print out the message.
  2. use this previous code

#Function print_table

#This function will print the tabular wind chill

#Input to function: none

#Output from function: none through the return statement

#Effect of cuntion: print table of temperatures and windchill indices

def print_table():

  print(“This is the magical wind chill calculator! Enter a temperature in degrees ”

        “Fahrenheit and a wind speed in MPH and see a wind chill value”)

  print(“See a sample below!”)

  print(“n”)

  print(format(“Temperature”,”20″),format(“Wind Speed”,”30″),format(“Wind Chill”,”30″),end=’n’)

  temp = 20

  wind = 19

  wct = 35.74 + 0.6215 * temp – 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,”<20,.2f”),format(wind,”<30,.2f”),format(wct,”<30,.2f”))

  temp = 0

  wind = 5

  wct = 35.74 + 0.6215 * temp – 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,”<20,.2f”),format(wind,”<30,.2f”),format(wct,”<30,.2f”))

  temp = -15

  wind = 25

  wct = 35.74 + 0.6215 * temp – 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,”<20,.2f”),format(wind,”<30,.2f”),format(wct,”<30,.2f”))

  print(“n=====================================================================n”)

#Function get_temp

#This function will input a tempertaure from the user

#and return the temperature to the calling function

#Input to function: None

#Output from function: returns the temperature input by the user

def get_temp():

#Function get_wind

#This function will input a wind speed from the user

#and return the wind speed to the calling function

#Input to function: None

#Output from function: returns the wind speed input by the user

def get_wind():

#Function calcWindChill

#This function will calculate the wind chill index

#Input to function: temperature and wind speed

#Output from function: returns the calculated wind chill

def calcWindChill(temp, wind):

#Function printWindChill

#This function will print the wind chill and the message

#Input to function: wind chill index, temperature, and wind speed

#Output from function: nothing through the return statement

#Effect of function: prints the temp, wind speed, and windchill index

#Prints a message

def printWindChill(wct, temp, wind):

def main():

  print_table()

  for index in range(5):

    print(“n”)

    temp_in = get_temp()

#insert call to function get_wind here

#Insert call tom function calcWindChill here

#insert call to function printWindChill here 

main()  

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!