Untitled
unknown
plain_text
2 years ago
1.7 kB
9
Indexable
/*
Created on : May, 2019
Author : Liisa Auer, Oulu University of Applied Sciences
Licence : CC-BY-4.0
*/
/*
* Student name :
* Started date :
* Ended date :
*
*/
function v10() {
const ERROR = "Points should be between 0 - 60.";
let x = Number(document.getElementById('points').value)
let output = ''
if (x<0 || x>60){
output = ERROR
}
else if ( x <= 29){
output = 'fail'
}
else if ( x <= 34){
output = 'satisfactory'
}
else if ( x <= 39){
output = 'fair'
}
else if ( x <= 49){
output = 'good'
}
else{
output = 'excellent'
}
document.getElementById('grade').innerHTML = output
}
function v11() {
const ERROR = "Hours should be between 0 - 24.";
let x = Number(document.getElementById('clock').value)
let output = ''
if (x<0 || x>24){
output = ERROR
}
else if ( x <= 3){
output = 'good Night'
}
else if ( x <= 11){
output = 'Good Morning'
}
else if ( x <= 17){
output = 'Good Afternoon'
}
else if ( x <= 20){
output = 'Good Evening'
}
else{
output = 'good Night'
}
document.getElementById('greeting').innerHTML = output
}
function v12() {
const ERROR_NEG = "Number of guests cannot be negative.";
const ERROR_DIGIT = "Number of guests must be integer.";
const ERROR_FEW = "Party is cancelled due to too few guests.";
const ADDRESS1 = "Naapuritie 1";
const ADDRESS2 = "Naapuritie 12";
const ADDRESS3 = "Juhlasalintie 34";
}
Editor is loading...