next up previous
Next: About this document

Home Work 1: Data Types, Variables and Expressions

Note: Submit all your programs (i.e., exercises 2-4) both as a hard copy and electronically using the ``handin'' command. Make sure to use the appropriate project number assigned to the problem when using the handin command. Otherwise, your homework solutions will be stored in a wrong file and thus may be evaluated incorrectly.

  1. Determine the appropriate variable type and names for the following. Give your justification for choosing the variable type.

    1. a person's age to the nearest year
    2. a person's weight in pounds
    3. the radius of a circle
    4. the cost of an item
    5. the highest grade on a test (assume it is always 100)
    6. the temperature
    7. the distance from the Earth to a star in miles
  2. (Project 1) Exercise 4 in page 21 of your text.
  3. (Project 2) Write a program that reads in four test scores, computes the average and displays the result.
  4. (Project 3) All of you are familiar with wind chill. There is an excellent formula to calculate the wind chill, given the ambient temperature in degrees Fahrenheit and the wind velocity in miles per hour. The formula is reasonable accurate for wind speeds between 5 and 90 MPH, and ambient temperatures between -40 and +90 tex2html_wrap_inline39 F.

    Here is the formula:
    c = ((10.45 + (6.686*sqrt(v))-(o.447*v))/22.034*(t-91.4))+91.4

    Here the function ``sqrt'' computes the square root. Write a C program to accept values for velocity and temperature to calculate the wind chill, c and print ``given the temperature ``t tex2html_wrap_inline39 F,'' and the wind velocity ``v,'' the wind chill is ....





Vijay &
Mon Feb 2 18:38:54 EST 1998