Lab 03
Version 1

 

This Lab reinforces the material in the lecture notes on using variables, the Math package, formatted output, and user input.

  1. Write a program which prompts the user for the height, width, and depth of a rectangular solid and computes and prints the volume of the solid. The program should use ints to store the values.

  2. Write a program which asks the user for an annual salary and tells them the equivalent hourly wage, based on working forty hours per week for fifty weeks per year. You should use doubles throughout the program. When you print the hourly wage, do so with exactly two digits to the right of the decimal (as you'd expect for monetary values).

  3. Write a program which asks the user for an angle in radians and tells them the value of all three basic trig functions for that value.

  4. Write a program which asks the user for an angle in radians and then prints output that will allow the user to confirm some of the basic trig identities (i.e. sin2 + cos2 = 1)

  5. Write a program which displays a random floating point value in the range between 0 and 1.

  6. Write a program which displays a random floating point value in the range between 0 and 10.

  7. Write a program which generates a random floating point value in the range between 0 and 2*pi and tells the user the value and the result of computing the three basic trig functions on that value.

Last modified August 28 for Fall 99 cs5 by fleck@cs.hmc.edu


This page copyright ©1998 by Joshua S. Hodas. It was built with Frontier on a Macintosh . Last rebuilt on Sun, Sep 6, 1998 at 1:23:27 PM.
http://www.cs.hmc.edu/~hodas/courses/cs5/week_03/lab.html