-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuiz.js
More file actions
77 lines (63 loc) · 2.46 KB
/
Quiz.js
File metadata and controls
77 lines (63 loc) · 2.46 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Coding Exercise #1 */
// var kecamatan = "Airmadidi";
// var kota = "Minahasa Utara";
// var propinsi = "Sulawesi Utara";
// var kode_pos = 95371;
// console.log(kecamatan + ", " + kota + ", " + propinsi + " - " + kode_pos);
//Solution
// var kecamatan, kota, propinsi, kodePos, alamat;
// kecamatan = 'Airmadidi';
// kota = 'Minahasa Utara';
// propinsi = 'Sulawesi Utara';
// kodePos = 95371
// alamat = kecamatan + ', ' + kota + ', ' + propinsi + ' - ' + kodePos;
// console.log(alamat);
// var studentGrade = 80;
// var maxGrade = 90;
// var percentage;
// console.log(percentage = studentGrade / maxGrade * 100);
/* Coding Exerice #2 */
//If temp between 60 to 90 print to "It is pretty nice out"
//If temp less than or equal to 0. print "Do not go outside"
//If temp more than or equal to 120, print "Do not go outside"
//Else print "Do what you want"
// var temp = 80;
// if(60 > 90){
// console.log("It is pretty nice out");
// } else if(temp <=0 && temp >=120){
// console.log("Do not go outside");
// } else{
// console.log("Do what you want");
// }
// Are both vegan? print "Only offer up vegan dishes"
// At least one vegan? print "Make sure to offer up some vegan options"
// Else, print "Offer up anything on the menu"
// var isGuestOneVegan = false;
// var isGuestTwoVegan = true;
// if (isGuestOneVegan === true && isGuestTwoVegan === true){
// console.log("Only offer vegan dishes")
// } else if(isGuestOneVegan || isGuestTwoVegan === true){
// console.log("Make sure to offer up some vegan options");
// } else{
// console.log("Offer up anything on the menu");
// }
// Coding Exercise #3
// Grade Calculator
// 1. Initialise 2 variable, student score and total score
// Ex: 15/20 = 75%
// Print to the console "You got a C (75%)"
// 4. A 90-100, B 80-89, C = 70-79, D 60-69, F 0-59
// var studentScore = 20;
// var totalScore = 20;
// var percentage = studentScore/totalScore*100;
// if(percentage>=90 && percentage<=100){
// console.log("You got A ("+percentage+"%)");
// } else if (percentage>=80 && percentage<=89){
// console.log("You got B ("+percentage+"%)");
// } else if (percentage>=70 && percentage<=79){
// console.log("You got C ("+percentage+"%)");
// } else if (percentage>=60 && percentage<=69){
// console.log("You got D ("+percentage+"%)");
// } else if (percentage>=0 && percentage<=59){
// console.log("You got F ("+percentage+"%)");
// }