Skip to content

wycliffe-kip/wk-1-code-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy Problems

Author:

Name: Wycliffe Chepchieng.
Nationality: Kenyan.
Current City: Nairobi, Kenya.

Challenge 1: Student Grade Generator (Toy Problem)

The javascript program prompts the user to input student marks. It then makes sure that the input is within the range of 0 and 100. Using the if statement, the program checks through different range of student marks and prints out grades for the different inputs from users. The grades ranges considered are:

To display message to the screen with the student's grade window.alert is used. A > 79, B - 60 to 79, C - 59 to 49, D - 40 to 49, E - less 40.

Challenge 2: Speed Detector (Toy Problem)

The Speed detector program takes as input the speed of a car. Using if statement, it checks the speed of the car and if it is less than 70, it prints “Ok”. Otherwise, for every 5 km/s above the speed limit (70), it outputs to the driver one demerit point and print the total number of demerit points.

To display message to the screen with the student's grade window.alert is used. 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)

The program calculates an individual’s Net Salary by getting the inputs of basic salary and allowances. Calculates the payee (i.e. Tax), NHIFDeductions, NSSFDeductions, gross salary, and net salary. To display message to the screen with the student's grade window.alert is used.