Here is my code so far, it doesent seem to be working. If you know of more efficient ways to write this code I'm open to any suggestions as I'm a total noob with java.
var temp1, temp2, temp3, temp4, temp5;
var day1, day2, day3, day4, day5;
var avg;
var highest;
var lowest;
var ES = "";
var BR = "</br>";
temp1 = prompt ("Employee, please enter the temperature in celcius that it was at noon on Monday", ES );
temp1 = parseInt (temp1);
temp2 = prompt ("Employee, please enter the temperature in celcius that it was at noon on Tuesday", ES );
temp2 = parseInt (temp2);
temp3 = prompt ("Employee, please enter the temperature in celcius that it was at noon on Wednesday", ES );
temp3 = parseInt (temp3);
temp4 = prompt ("Employee, please enter the temperature in celcius that it was at noon on Thursday", ES );
temp4 = parseInt (temp4);
temp5 = prompt ("Employee, please enter the temperature in celcius that it was at noon on Friday", ES );
temp5 = parseInt (temp5);
if (temp1 > temp2, temp3, temp4, temp5) {
temp1 = highest;
}
else if (temp2 > temp1, temp3, temp4, temp5) {
temp2 = highest;
}
else if (temp3 > temp1, temp2, temp4, temp5) {
temp2 = highest;
}
else if (temp4 > temp1, temp3, temp2, temp5) {
temp2 = highest;
}
else if (temp5 > temp1, temp3, temp4, temp2) {
temp2 = highest;
}
if (temp1 < temp2, temp3, temp4, temp5) {
temp1 = lowest;
}
else if (temp2 < temp1, temp3, temp4, temp5) {
temp2 = lowest;
}
else if (temp3 < temp1, temp2, temp4, temp5) {
temp2 = lowest;
}
else if (temp4 < temp1, temp3, temp2, temp5) {
temp2 = lowest;
}
else if (temp5 < temp1,temp3,temp4,temp2) {
temp2 = lowest;
}
avg = temp1 + temp2 + temp3 + temp4 + temp5 / 5
document.write("Welcome to the temperature calculater program!" + BR);
document.write("The highest recorded temperature is " + highest + BR);
document.write("The lowest recorded temperature is " + lowest + BR);
document.write("The mean temperature is " + avg + BR);
document.write("Thanks for using the program and have a great day!");
This post has been edited by modi123_1: 21 October 2016 - 09:10 AM
Reason for edit:: In the future, please use the '[code]' tag button in the editor.

New Topic/Question
Reply


MultiQuote





|