When I run this I get average high temp nandegrees var num1=parseInt(prompt(num1
ID: 3658397 • Letter: W
Question
When I run this I get average high temp nandegrees var num1=parseInt(prompt(num1 +("Enter high temp for day 1."))); var num2=parseInt(prompt(num1 +("Enter high temp for day 2."))); var num3=parseInt(prompt(num1 +("Enter high temp for day 3."))); var num4=parseInt(prompt(num1 +("Enter high temp for day 4."))); var num5=parseInt(prompt(num1 +("Enter high temp for day 5."))); var num6=parseInt(prompt(num1 +("Enter high temp for day 6."))); var num7=parseInt(prompt(num1 +("Enter high temp for day 7."))); var sum=parseInt("num1 + num2 + num3 + num4 + num5 + num6 + num7"); alert("average high temp "+ sum + "degrees");Explanation / Answer
It script triggers an alert with the sum of the 7 temperatures using: alert("average high temp "+ sum + "degrees"); To get the average, adjust the script as follows: alert("average high temp "+ sum/7.0 + "degrees"); Hope that helps. Good luck!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.