ECE 1620 - Assignment #4 - Due: 11 Feb 2022


  1. a4/p1.c - Fahrenheit to Celsius Table

    Start with a copy of your function to convert degrees Fahrenheit to degrees Celcius from assignment #2.

    In the main program, call your function in a loop to generate a table of conversions from Fahrenheit to Celsius for values of degrees Fahrenheit from -10 to 220 in steps of 10 degrees.

    The output must include column headings and the columns of output values must be aligned neatly, for example:

     Fahrenheit  Celsius
            -10   -23.33
              0   -17.78
             10   -12.22
             20    -6.67
             ...
    

  2. a4/p2.c - Birthday Collision Probabilities

    Write a program using a loop to generate a list of birthday collision probabilities similar to the table in the week #3 notes from class.

    Assignment #2 showed the formula for birthday collisions with 5 people. Here use a loop to generate values for number of people (k) from 1 to 50. The initial probability of no collisions is 1. Each time through the loop the probability of no collisions is updated by the factor (365-k+1)/365.0, and then k and the probability of collisions (1 minus the probability of no collisions) are printed.

    The output must be suitable for plotting, i.e. just two columns of numbers with no headings. The columns do not need to be aligned neatly.
    Plot the program output using the VECR 2D plot button:


  3. a4/p3.c - Weather Balloon Altitude Polynomial

    Write a function to evaluate the altitude polynomial from page 146 at a point t, using nested form with a minimum number of multiplications and without using pow:

    In the main program, call the function in a loop for values of t from 0 to 48 in steps of 0.5

    The output must be suitable for plotting, i.e. just two columns of numbers (time and altitude), with no headings. The columns do not need to be aligned neatly, just use %g format.
    Plot the program output using the VECR 2D plot button:
    Your plot should look similar to the one on page 146.

    Extra/optional


  4. a4/p4.c and a4/p4.txt - 2D Point Rotation

    Start p4.c with a copy of the scanf_Points.c program, and create p4.txt with a copy of the heart_Points.txt input data file.

    Compile and run to make sure it works to start with. Redirect input from p4.txt in the plot args field:

      args: < p4.txt
    
    and use the 2D plot icon to plot the program output.

    Modify the program: for each input point, use the formulas for 2D rotation to create a new point, rotated by 16 degrees, and print the new point instead of the original point.