-
Notifications
You must be signed in to change notification settings - Fork 10
/
assignment.js
111 lines (74 loc) · 2.13 KB
/
assignment.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/***********
Problem 1:
A company decided to give bonus of 5% to an employee if his/her year of service is more than 5 years. Given a salary and year of service and print the net bonus amount.
Variables Required (feel free to add your own variables if needed):
salary (number)
yearsOfService (number)
Test Cases:
Use the following test cases to confirm your program meets the success criteria
1. Given the following:
salary = 50000
yearsOfService = 6
Result: 2500
2. Given the following:
salary = 90000
yearsOfService = 5
Result: 0
3. Given the following:
salary = 83000
yearsOfService = 9
Result: 4150
************/
console.log('Problem 1:')
// Add your code below this line
// Add your code above this line
console.log('')
console.log('-----------------')
/***********
Problem 2:
Write a program that finds the average of all the numbers in a given array
Variables Required (feel free to add your own variables if needed):
numbers (array)
Test Cases:
Use the following test cases to confirm your program meets the success criteria
1. Given the following:
problem1Numbers = [1, 2, 3]
Result: 2
2. Given the following:
problem1Numbers = [9, 18, 62, 3, 17]
Result: 21.8
************/
console.log('Problem 2:')
// Add your code below this line
// Add your code above this line
console.log('')
console.log('-----------------')
/***********
Problem 3:
Fizz buzz. Write a program that will iterate through numbers 1 to 100 and do the following:
- if the number is divisible by 3, print "fizz"
- if the number is divisible by 5, print "buzz"
- if the number is divisible by 3 and 5, print "fizzbuzz"
- if the number is not divisible by 3 or 5 just, print the number
Variables Required: none (choose your own)
Test Cases:
Use the following test cases to confirm your program meets the success criteria
1. Given the following:
Expected Result:
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
************/
console.log('Problem 3:')
// Add your code below this line
// Add your code above this line
/** added for formatting purposes **/
console.log('')
console.log('-----------------')