Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Weather Checking Program

<!DOCTYPE html>
<html>
<title>Web Page Design</title>
<head>
<script>

//task 4A
document.write("Check weather today: <br>");
var weather = prompt ("Is the weather cloudy? ");
if(weather == "Yes"){
    document.write("Bring umbrella. ");
}
else{
    document.write("Go out and play! ");
}
document.write("<br><br>");

//task 4B.1
document.write("Check weather today: <br>");
var weather = prompt ("Is the weather cloudy? ");
weather = weather.toUpperCase();
if(weather == "YES"){
    document.write("Bring umbrella. ");
}
else {
    document.write("Go out and play! ");
}
document.write("<br><br>");

//task 4B.2
document.write("Check weather today: <br>");
var weather = prompt ("What is the weather today? Use 'a' for cloudy, 'b' for sunny and 'c' for rainy");
if(weather == "a") {
    document.write("The weather today is cloudy. Bring an umbrella. ");
}
else if (weather == "b") {
    document.write("The weather today is sunny. Go out and play! ");
}
else {
    document.write("The weather today is rainy. Stay at home. ")
}
document.write("<br><br>");



</script>
</head>
<body>
</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.