-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05) Assessmrnt 1.js
35 lines (26 loc) · 1.54 KB
/
05) Assessmrnt 1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
1) Weather Report:
You are given the following variables,
personName
currentTemperature
shiveringTemperature (the temperature at which the person will start shivering.)
hourlyTemperatureDecrease (the amount by which the temperature drops every hour.)
Your task is to calculate how many hours it will take before the person starts shivering, store the result in a variable called hoursRemainingForShivering, and log it to the console in the following format:
[personName] will start shivering in [hoursRemainingForShivering] hours.
Solution:
const personName = "Sam";
const shiveringTemperature = 20;
const currentTemperature = 30;
const hourlyTemperatureDecrease = 2;
const hoursRemainingForShivering = (currentTemperature - shiveringTemperature) / hourlyTemperatureDecrease
console.log(`${personName} will start shivering in ${hoursRemainingForShivering} hours.`)
2) Teamwork:
Eve, Sam and Renu are competing as a team for India in the Olympics relay race. Each has to do 1 lap then pass the baton.
The average speed of each of them are given in the variables averageSpeedEve, averageSpeedSam, and averageSpeedRenu respectively.
Store the average speed to a variable called averageSpeed, and then log it to the console in the format:
The Average speed of Team India was [Average Speed] meters per second.
Solution:
const averageSpeedEve = 42;
const averageSpeedSam = 43;
const averageSpeedRenu = 39;
const averageSpeed = (averageSpeedEve + averageSpeedSam + averageSpeedRenu) / 3;
console.log(`The Average speed of Team India was ${averageSpeed} meters per second.`)