You are on page 1of 2

CSci 111: Web Programming and Problem Solving Fall 2014

Homework Assignment #5
Due date: Thursday, October 09, 23:55:00
The assignment will test your skills in the basics of the JavaScript language.
Assignment description
You will need to use http://writecodeonline.com/javascript interpreter for this Homework assignment.
Complete the problems below. Write Javascript code to solve the problems in the interpreter. In some
cases you may need to look up data or find the correct formula. In most of the tasks, you need to use
prompt function, to get initial values from a user.
Copy all your code from the interpreter into single .txt file, and submit this file containing all your
solutions on Moodle by Thursday midnight.

1) Get from the user a distance in kilometers, convert that value to the equivalent value in miles.
2) Get from user a number of hours and minutes, convert the given time into seconds.
3) Get from the user the height and radius of a cylinder in centimeters. Calculate the volume of the
cylinder in liters.
4) Get from user a persons body weight in pounds, convert that value to koala units (koala
weighs 19.8 pounds).
5) Get from user an Earth-bound weight in kilograms, calculate the corresponding weight if that
person were on the surface of the moon, or the planet Neptune, or the planet Mercury.
6) Get from user the lengths of the three sides of a triangle (a, b, and c). Calculate the area of the
triangle.
7) Calculate the mid-term grade of a student, given two quiz scores and three homework scores.
The average quiz score weighs 50% in the final score and the average homework score weighs
the other 50% in the final score.
8) Suppose a person walks, on average, three kilometers per day for every day of her life.
Calculate how many times they could have circled the Earth if they live to be 55, or 72, or 96.
9) Suppose you buy 2 cups of coffee every day, Monday through Friday, and two chocolate bars
each Friday and Saturday night for eight months of the year. If a cup of coffee costs 350 tenge,
and a chocolate bar costs 360 tenge, how much money will you have spent on these by the time
you finish four years at university?
10) What is the area of a regular hexagon with sides 1 inch long? Print the result in cm^2.
CSci 111: Web Programming and Problem Solving Fall 2014


Submission instructions
The assignment should be submitted as a single file containing all JavaScript codes to Moodle before the
deadline. For this assignment you also need to do live grading. Each of your short programs should be
completed and tested before you come in for live gradingif any of the programs do not work, you may
be required to make changes to the code and have it rechecked in person before you get credit for live
grading.
Marking
These are the aspects of your work on which we will focus in the marking:
Correctness: All of the functional and structural requirements have been met by the code.
Correctness will count for the largest single portion of your marks. To get full credit you also
have to demonstrate understanding of the assignment during live grading. (80/100 points)
Style and Organization: Your JavaScript code should be properly formatted and commented so
as to be easily understandable. (20/100 points)

You might also like