Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bonusScore(studentsCount,lecturesCount,additionalBonus,input) {
- let highest = 0;
- let attendedLectures = 0;
- for (let i = 0; i < studentsCount; i++) {
- let attendancy = input.shift();
- let totalBonus = Math.round(attendancy / lecturesCount * (5 + additionalBonus));
- if (totalBonus >= highest) {
- highest = totalBonus;
- attendedLectures = attendancy;
- }
- }
- console.log(`Max Bonus: ${highest}.`);
- console.log(`The student has attended ${attendedLectures} lectures.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement