Click here to Skip to main content
14,579,188 members
Rate this:
Please Sign up or sign in to vote.
See more:
1.Write the JS code to perform the temperature conversions.2.Use prompt to enter the temperature for conversion.3.Create 2 functionsto perform the conversions:•toCelsius()•toFahrenheit()4.Use the formulas below:To convert Fahrenheit to Celsius:celcius =(5/9)*(fahrenheit-32)To convert Celsius to Fahrenheit:fahrenheit = (Celsius* 9/5) + 325.For function, toCelsius(), both Celsius(calculated value) and Fahrenheit(argument) have to return to the call function.Declare the call function as : vararr1=toCelcius(212);(note: arr1 is an array)6.For function, toFahrenheit(), both Fahrenheit (calculated value) and Celsius (argument) have to return to the call function.Declare the call function as :var arr2=toFahren(100);(note: arr2 is an array)7.For both functions, return the resultsand display using:document.getElementById(“show”) as shown on the right.(Hint1: to display oC or oF, e.g. str=”o”, use str.sup())(Hint2: Use array[ ] to retrieve the return values)Note: correct the result to 2 dec. no. of places

What I have tried:

HTML:



<title>lab13_challenge




<h1>F2C/C2F Temperature Conversions</h1>

<br>

<p id="show">Display temperature conversions below:</p>





Javascript: function click1(){
	var quotients= 10/2;
	var product=6*2;
	return[quotients,product];
	
	
}

var arrResult=click1();
document.getElementById("show").innerHTML +=("<br>Quotient is" +arrResult[0]);
document.getElementById("show").innerHTML +=("<br>Product is " +arrResult[1]);
Posted
Updated 25-Jun-20 19:00pm
v2
Comments
Dave Kreskowiak 25-Jun-20 22:43pm
   
and you had a question you forgot to ask?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100