Random Weather Forecast Program Make a program to convert celsius tempatures to fahrenheit and vice versa, so we can complain about the weather with our
Random Weather Forecast Program
Make a program to convert celsius tempatures to fahrenheit and vice versa, so we can complain about the weather with our friends overseas.
Reminder: To convert celsius to fahrenheit, multiply by 9, then divide by 5, then add 32. To convert fahrenheit to celsius, deduct 32, then multiply by 5, then divide by 9.
Unicode Characters: To print the degrees symbol in JavaScript, we need to use the write \u00B0 to represent the unicode character for the degress symbol.
Requirements
- Store a celsius temperature into a variable.
- Convert it to fahrenheit and output "NNC is NNF" in an HTML field (don't use alert)
- Now store a fahrenheit temperature into a variable.
- Convert it to celsius and output "NNF is NNC." in an HTML field (don't use alert)
JavaScript has a built-in tool that can generate a random number between 0 and 1. This tool is called a method. We'll talk about methods more later in the class. For now, know if you type Math.random(), you'll get a random number between 0 and 1.
Using this tool, update your fahrenheit to celsius tempature conversion program to do the following:
- Instead of inputing a value for the Fahrenheit tempature, use Math.random() to generate a random tempature between 0 and 100
- Have to program output: "It is NNF today. That's NNC." in an HTML field (don't use alert)
Your program should have an HTML page and a .JS file. Submit both files as a single zip file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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