Home

Homework   Index   Syllabus   URM Simulator


For HW #16

Computers and Reality - Cognitive Science 110 - Spring 2007


  1. Write a JavaScript program that produces a Celsius-to-Fahrenheit conversion table for Celsius temperatures ranging from 0 to 100 in 2-degree steps. Use the formula F = 9/5(C+32). Note: you must use the symbol * for multiplication:  F = 9/5 * (C + 32). Here's a sample of what your table should look like:

    C F
    0 32
    2 35.6
    4 39.2
    6 42.8
    8 46.4
    10 50
    12 53.6
    ...
    92 197.6
    94 201.20000000000002
    96 204.8
    98 208.4
    100 212
  2. Write a JavaScript program that computes the following function:
    f(x) = {  x/2               if x is even
    3x+1            otherwise

Updated: 31 August, 2009 17:44:19