Algorithm We already have an algorithm for Patient Temperature. It will not change. The Algorithm for Patient Temperature: get the temperature implementation: with a prompt box before, now it will come from a widget assess it with conditionals and variables implementation: pretty much the same as before output a user-friendly message implementation: with an alert box or text before, now some text and images Your Mission For each of the two if-statements: replace false with the correct conditional expressions for this program to make sense. change each of the three images by finding new urls. <!DOCTYPE html><html><body> 90°<input type="range" min="90" max="110" id="temperature" step=.1 oninput="changeTemp()">110°<p id="assessmentText">Move the slider</p><img id="assessmentImage" width=50 src='https://www.maxpixel.net/static/photo/1x/Questions-Puzzle-Cartoon-Consider-Smiley-3082809.png'> <script>const temperatureFever = 99.5 ; // maximumconst temperatureHypothermia = 95 ; // minimumconst imageFever='https://cdn.pixabay.com/photo/2018/12/24/17/07/catch-a-cold-3893262_960_720.png';const imageHypothermia='https://cdn.pixabay.com/photo/2018/12/19/20/23/samuel-3884706_960_720.png';const imageNormal='https://cdn.pixabay.com/photo/2019/02/19/19/45/thumbs-up-4007573_960_720.png'; function changeTemp() { // Automatically happens when the slider // Algorithm step 1: get the temperature// Implementation: get it from the range finder:var userResponse=document.getElementById("temperature").value;var assessmentText='?';var assessmentImage='';// Algorithm step 2: assess// Implementation: not much different than beforeif ( false ) {assessmentText=" Hypothermia";assessmentImage=imageHypothermia;}else if (false) {assessmentText=" Fever";assessmentImage=imageFever;}else {assessmentText=" Normal";assessmentImage=imageNormal;}// Algorithm step 3: display user-friendly output// Implementation: using variables makes this code work every timedocument.getElementById('assessmentText').innerHTML=userResponse+'° '+assessmentText;document.getElementById('assessmentImage').src=assessmentImage;}</script></body></html>
Algorithm
We already have an algorithm for Patient Temperature. It will not change.
The Algorithm for Patient Temperature:
- get the temperature
- implementation: with a prompt box before, now it will come from a widget
- assess it with conditionals and variables
- implementation: pretty much the same as before
- output a user-friendly message
- implementation: with an alert box or text before, now some text and images
Your Mission
For each of the two if-statements:
- replace false with the correct conditional expressions for this program to make sense.
- change each of the three images by finding new urls.
<!DOCTYPE html><html><body>
90°<input type="range" min="90" max="110" id="temperature" step=.1 oninput="changeTemp()">110°
<p id="assessmentText">Move the slider</p>
<img id="assessmentImage" width=50 src='https://www.maxpixel.net/static/photo/1x/Questions-Puzzle-Cartoon-Consider-Smiley-3082809.png'>
<script>
const temperatureFever = 99.5 ; // maximum
const temperatureHypothermia = 95 ; // minimum
const imageFever='https://cdn.pixabay.com/photo/2018/12/24/17/07/catch-a-cold-3893262_960_720.png';
const imageHypothermia='https://cdn.pixabay.com/photo/2018/12/19/20/23/samuel-3884706_960_720.png';
const imageNormal='https://cdn.pixabay.com/photo/2019/02/19/19/45/thumbs-up-4007573_960_720.png';
function changeTemp() { // Automatically happens when the slider
// Algorithm step 1: get the temperature
// Implementation: get it from the range finder:
var userResponse=document.getElementById("temperature").value;
var assessmentText='?';
var assessmentImage='';
// Algorithm step 2: assess
// Implementation: not much different than before
if ( false ) {
assessmentText=" Hypothermia";
assessmentImage=imageHypothermia;
}
else if (false) {
assessmentText=" Fever";
assessmentImage=imageFever;
}
else {
assessmentText=" Normal";
assessmentImage=imageNormal;
}
// Algorithm step 3: display user-friendly output
// Implementation: using variables makes this code work every time
document.getElementById('assessmentText').innerHTML=userResponse+'° '+assessmentText;
document.getElementById('assessmentImage').src=assessmentImage;
}
</script></body></html>
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images