CS 1620 Assignment #7 Spring 2001

How to handin.
Due : Monday Apr 2, 2001 @ midnight
Note : No grace period for this homework since the due date has been extended from March 30th to April 2nd
  1. Write a C++ program to print the following table:

    Table of sin(x), where x is given in degrees
           0     1     2     3     4     5     6     7     8     9
     0 0.000 0.017 0.035 0.052 0.070 0.087 0.105 0.122 0.139 0.156
    10 0.174 0.191 0.208 0.225 0.242 0.259 0.276 0.292 0.309 0.326
    20 0.342 0.358 0.375 0.391 0.407 0.423 0.438 0.454 0.469 0.485
    30 0.500 0.515 0.530 0.545 0.559 0.574 0.588 0.602 0.616 0.629
    40 0.643 0.656 0.669 0.682 0.695 0.707 0.719 0.731 0.743 0.755
    50 0.766 0.777 0.788 0.799 0.809 0.819 0.829 0.839 0.848 0.857
    60 0.866 0.875 0.883 0.891 0.899 0.906 0.914 0.921 0.927 0.934
    70 0.940 0.946 0.951 0.956 0.961 0.966 0.970 0.974 0.978 0.982
    80 0.985 0.988 0.990 0.993 0.995 0.996 0.998 0.999 0.999 1.000
    
    To use the table to find the sin of, for example, 35 degrees, you would look for the row starting with 30, then move across to the column for 5, giving you a value of 0.574.)

    Note about sin: The prototype for the sin function is in the cmath header file.

    The argument of sin is given in radians, not degrees.

                     degrees × 
          radians =  ------------
                         180
    
    where is approximately 3.1415926.
    Note about formatting: For formatting purpose, include iomanip in your program and you may use setw, setprecision, setiosflags ... (For more details, refer to pages 244, 272 and 413 of your textbook).

  2. Rewrite problem #2 of Homework #6 using a function called getMaxMinAve. The function will accept count, max and min as reference parameters and returns the average.

  3. Textbook page 370, problem #2.

  4. Write a program using enumerated types which, given today will print out yesterday.
    Here is a sample input/output:
    Input:  Friday
    Output: Thursday
    
!! Note: Your grade will be awarded for program correctness, readability, and documentation.
Assignment List | Prev | Next | Computer Science 1620
Department of Mathematics & Computer Science
University of Lethbridge Home Page