Michael C. Estigoy

CCSF CNIT 133 – JavaScript

Homework 4 – Looping Statements

This is a two task section:

Part 1a) calculate the product and sum of every third integer from 5 - 20 using the for statement

Part 1b) calculate the product and sum of every fourth integer from 3-31 using while / do while statement



Part 1a:


Part 1b:

Display the gross pay for six employees. The company pays "straigt time" for the first 40 hours worked by each employee and pays "time and a half" for all hours worked in excess of 40 hours.



Employee Gross Pay
EmployeeHours Worked Hourly Rate
Employee 1
Employee 2
Employee 3
Employee 4
Employee 5
Employee 6

Calculate compound interest on a principal of $1000 with annual interest rates between 5 to 10% for a period between 1 to 10 years.

The formula used is: A=P(1 +r) n

  • P is the principal
  • r is the annual interest rate
  • n is the number of years the amount is deposited
  • A is the amount of money (including interest) accumulated after n years


Display the total amount of products sold from a mail-order business.

The business sells 5 products:

  • Product 1 – $2.98
  • Product 2 – $4.50
  • Product 3 – $9.98
  • Product 4 – $4.49
  • Product 5 – $6.87


Product Sales


Display list variations. The options are: unordered list, ordered number list, and ordered letter list.



List Formats

In the Pick a list style field, enter:

  • option 1 for an unordered list
  • option 2 for a numbered list
  • option 3 for a letter list
Once you've entered a single option number click on the Display List button to display your list choice below.

Print "The Twelve Days of Christmas" song using repetition and switch statement(s)



cheesy presents