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.
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.
before your boss allows adjustable thermostats in the office suite, he must be convince that temperature...
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 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...