-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathconditionals.js
More file actions
59 lines (49 loc) · 2.39 KB
/
Copy pathconditionals.js
File metadata and controls
59 lines (49 loc) · 2.39 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// **** Problem 1: R-rated ****
// You cannot see an R-rated movie unless you are at least 18, or you are with
// an adult. Write code that prints whether or not someone can see an
// R-rated movie.
console.log("*** Problem 1: R-rated ***");
let age; // assign a number
let withAdult; // assign a boolean
// **** Problem 2: Umbrella ****
// You should bring an umbrella when you travel, but only if it is raining.
// However, if it is thunderstorming, you should not bring an umbrella since
// that's bad luck. Note that if it is thunderstorming, it is obviously raining
// as well. Write code that prints if someone should bring an umbrella
// with them.
console.log("*** Problem 2: Umbrella ***");
let raining; // assign a boolean
let thunderstorming; // assign a boolean
// **** Problem 3: Monkey Trouble ****
// There are two monkeys: Bubbles and Spankey. You are in trouble if both of
// them are smiling, or if neither are smiling. Write code that prints if we
// are in trouble.
console.log("*** Problem 3: Monkey Trouble ***");
let bubblesSmiling; // assign a boolean
let spankeySmiling; // assign a boolean
// **** Problem 4: First Place ****
// Write code that prints the largest of three scores. If there is a tie for
// first place, simply print one of the tie winners.
console.log("*** Problem 4: First Place ***");
let score1; // assign a number
let score2; // assign a number
let score3; // assign a number
// **** Problem 5: Phone Shopping ****
// At a phone store, you can afford various "tiers" of phones based on how
// much money you have.
// If you have at least $30 you can buy a prepaid phone.
// If you have at least $100 you can buy a bottom-tier phone.
// If you have at least $300 you can buy a middle-tier phone.
// If you have at least $600 you can buy a top-tier phone.
// Write code that prints all the phone tiers someone can buy based on how much
// money they have.
console.log("*** Problem 5: Phone Shopping ***");
let money; // assign a number
// **** Problem 6: Guess My Number ****
// Write code that simulates a simple number guessing game. If "guess" matches
// "myNum" print a congratulations message. If the guess is too low or too high,
// print either of those messages. If the guess is myNum +/- 3, print that
// the guess is "warm"; otherwise print that it is "cold".
console.log("*** Problem 6: Guess My Number ***");
let myNum; // assign a number
let guess; // assign a number