Question

before your boss allows adjustable thermostats in the office suite, he must be convince that temperature...

before your boss allows adjustable thermostats in the office suite, he must be convince that temperature variations occur in different offices and within each office on different days. your're to write a program that allows each employee to enter the temperature at noon on each of five days and displays the highest, lowest, and average(mean) temperatures.

use Javascript to design a complete algorithm that accept five daily temperature readings and display the highest, lowest and average temperatures. use the for loop to take the five readings. (Hint: initialize the highest and lowest temperature variable to the first temperature that's read, and then compare other temperatures to see whether they're lower or higher)..

use Javascript the parseFloat() method to convert your temperature input to a decimal number and display the average to one decimal place.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

<html>
< head>
< script>
function calculateTemp()
{
var temp=[];
temp[0]=parseFloat(prompt("Enter day 1 temperature"));
var highest=temp[0];
var lower=temp[0];
var average=temp[0];
for(var i=2;i<=5;i++)
{
temp[i-1]=parseFloat(prompt("Enter the day "+i+" temperature"));
if(highest<temp[i-1])
highest=temp[i-1];
if(lower>temp[i-1])
lower=temp[i-1];
average+=temp[i-1];
}
average=average/5;
console.log("Highest Temperature:"+highest+", Average Temperature:"+average+", Lower Temperature:"+lower);
alert("Highest Temperature:"+highest+", Average Temperature:"+average+", Lower Temperature:"+lower);
}

< /script>
< /head>
< body>
< script>
calculateTemp();
< /script>
< /body>
< /html>

Please give thumbsup, if you like it. Thanks.

Add a comment
Know the answer?
Add Answer to:
before your boss allows adjustable thermostats in the office suite, he must be convince that temperature...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write down your analysis of this case on factors like the interests involved, context and power...

    Write down your analysis of this case on factors like the interests involved, context and power PACIFIC OIL COMPANY (A)* "Look, you asked for my advice, and I gave it to you," Frank Kelsey said. "If I were you, I wouldn't make any more concessions! I really don't think you ought to agree to their last demand! But you're the one who has to live with the contract, not me!" Static on the transatlantic telephone connection obscured Jean Fontaine's reply....

  • Write down your analysis of this case on factors like 1. the negotiation process, strategy and...

    Write down your analysis of this case on factors like 1. the negotiation process, strategy and tactics PACIFIC OIL COMPANY (A)* "Look, you asked for my advice, and I gave it to you," Frank Kelsey said. "If I were you, I wouldn't make any more concessions! I really don't think you ought to agree to their last demand! But you're the one who has to live with the contract, not me!" Static on the transatlantic telephone connection obscured Jean Fontaine's...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT