Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Challenge : TOY PROBLEMS

This repository contains three solutions to three code challenges using functions written in JavaScript.

Author

Tabitha L

Set Up

1.Clone this repository to your local machine ``sh git clone https://github.com/yourusername/your-repository.git 2.Install the dependancies using cd your-repository npm install

3.Run the solutions Open a terminal or command prompt on your computer. Run your Node.js application using the 'node' command followed by the filename of your JavaScript file. For example, if your file is named index.js, you would run: 'node index.js'

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.

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”.

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.

#How to run the challenges In order to run the challenges installation of the propmt-sync dependancy is required by running npm install prompt-sync in the terminal. Run every challenge by typing node nameoffile.js and running it in the terminal.

Licence

This project is licensed under the MIT License .

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages