

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CS 101 Unpledged
CS 101 Page 1 of 2 Spring 1998
Please perform the following activities. This assignment is unpledged. However, you may not work with anyone else on this first assignment. You are allowed to talk with others, but your work must be your own.
Objective
The objective of this assignment is twofold: to practice coding programs that do interactive input and output, and to make sure that you understand how to write simple programs that compute use- ful things. Good programmers often write small programs to do a short, useful computation.
Problem
Produce a program that computes and displays the heat index (perceived temperature) from two user-supplied floating point values: a Fahrenheit temperature T and a relative humidity percentage R. There are several slightly different formulas for computing heat index. The formula we shall use comes from USA Today ’s weather website at http://www.usatoday.com.
HeatIndex = -42.379 + 2.04901523 T + 10.14333127 R - 0.22475541 TR - 6.83783e-03( T 2 )
Besides displaying the heat index value, your program should supply a legend that suggests that its user take care when the heat index is greater than 90 and even more so when the heat index exceeds 110.
Remember to prompt the user for the inputs, then echo them in a meaningful fashion.
All floating point values should use C++’s double representation.
Notes
Please review the CS101 style sheet before starting on the assignment. Be sure to use the standard header (i.e., your name, section number, etc.) in your program. The standard header for all our programs (unless instructed otherwise) will contain the following information:
// Programmer: // Student ID: // E-mail: // CS101 Lab Section: // CS 101 Lab time:
You should submit your program electronically before the start of laboratory 3. See the CS website ( http://www.cs.virginia.edu/cs101 ) for information on how to do this. Your program must be called hw01.cpp.
You should also turn in a hardcopy (printout) at the beginning of your laboratory when the pro- gram is due. This hardcopy is due at the beginning of laboratory 3.
CS 101 Unpledged
CS 101 Page 2 of 2 Spring 1998
The grading criteria for this assignment can also be found at our class website.
A sample run of the type of output that your program should produce is given below. Observe the legend, nice prompts, and labeled output. The phrasing that you use does not need to exactly mimic this sample, but it does need to be of similar quality.