Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bett-bett/toy-problem
https://github.com/bett-bett/toy-problem
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bett-bett/toy-problem
- Owner: bett-bett
- License: mit
- Created: 2023-09-26T04:35:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-26T06:00:47.000Z (over 1 year ago)
- Last Synced: 2024-11-14T08:15:39.369Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code challenge: Toy problem
Phase 1 code challenge. Toy problem
## Challenge 1: Student Grade Generator (Toy Problem)
- Write a function that prompts the user to input student marks.
- The input should be between 0 and 100.
- The output should correspond the correct grade, as shown below:A > 79, B - 60 to 79, C - 59 to 49, D - 40 to 49, E - less 40.
**Setup:**
run challenge 1
`node challenge1.js`## Challenge 2: Speed Detector (Toy Problem)
Write a program that takes the speed of a car as input e.g 80. If the speed is less than 70, it should print “Ok”. Otherwise, for every 5 km/s above the speed limit (70), it should give the driver one demerit point and print the total number of demerit points.
For example, if the speed is 80, it should print: “Points: 2”. If the driver gets more than 12 points, the function should print: “License suspended”.
**Setup:**
used prompt-sync, a js module to get user prompts from the terminal
`npm install prompt-sync`
run challenge 2
`node challenge2.js`## Challenge 3: Net Salary Calculator (Toy Problem)
Write a program whose major task is to calculate an individual’s Net Salary by getting the inputs of basic salary and benefits. Calculate the payee (i.e. Tax), NHIF Deductions, NSSF Deductions, gross salary, and net salary.
**Setup:**
`node challenge3.js`## BubbleSort
Bubble Sort repeatedly steps through the list,
compares adjacent elements, and swaps them if they are in the wrong order.
The pass through the list is repeated until no swaps are needed,
which means the list is sorted!**Setup**
`node bubble.js`