Due: Monday, February 1, 2016
This assignment gets you programming!
Over this week and the next we'll be looking at Lesson #5, Lesson #6, Lesson #7, and Lesson #8. Those lessons go into more detail than we need for this assignment, but all the material in them will be covered soon enough.
Write a program that makes a conversion table from degrees Fahrenheit to degrees Celsius. Your program should prompt the user for three inputs (all double precision floating point numbers): a start temperature, an end temperature, and a temperature step. These temperatures are all assumed to be in degrees Fahrenheit. The program should then print an appropriate table.
Here is a sample run of the program:
$ f2c Start: 50 End : 80 Step : 10 degrees F degrees C --------- --------- 50.00 10.00 60.00 15.56 70.00 21.11 80.00 26.67 $
Notice that the degrees F for each row are advanced by an amount given by the temperature step. The precise format of the table is up to you, but be sure it "looks good." It should have decimal points aligned in both columns. I recommend using two decimal places (but you can use some other number if you want). Be sure to allow negative temperatures and account for a negative sign when planning the output.
The conversion formula is given by C = (5/9)(F - 32). However, be sure to use floating point constants; specifically, 5/9 as written will be computed as zero by the program (why?), and you don't want that.
What does your program do if the interval between the start and end temperatures is not evenly divisible by the temperature step size? Does the behavior seem reasonable to you?
Submit your program to Moodle (the .c file). Be sure it includes a comment block at the top that includes your name, the name of the file, the date, and a brief description of what the program does.
Last Revised: 2024-12-17
© Copyright 2024 by Peter Chapin <peter.chapin@vermontstate.edu>