2-Average3, Heads/Tails, Fahr->Cent
1. Average3 (Savitch, page 123, problem 2)- Write a program that reads in three whole numbers and outputs the average of the three numbers. The average of three numbers is the sum of three numbers, divided by the number 3. The output should be as a double(have a decimal point).
2. Heads/Tails(Savitch, page 124, problem 6)- Write a program that will print out statistics for eight coin tosses. The user will input either an 'h' for heads or a 't' for tails for eight tosses, then the program will print out the total number of heads and tails. Use the increment operator to count each 'h' and 't' input. For example, a possible sample dialog(with user input in bold) might be:
For each coin toss enter either 'h' for heads or 't' for tails.
First toss: h
Second toss: t
Third toss: t
Fourth toss: h
Fifth toss: t
Sixth toss: h
Seventh toss: t
Eighth toss: t
Number of heads: 3
Number of tails: 5
Percent heads: 37.5
Percent tails: 62.5
3. Fahr->Cent (Savitch, page 125, problem 8) Write a program that converts degrees Fahrenheit to Celsius using the formula
degreesC = 5(degreesF - 32)/9
Prompt the user to enter a temperature in degrees Fahrenheit(just a whole number of degrees, without a fractional part) and print out the equivalent Celsius temperature including the fractional part to at least one decimal point. A possible dialog might be
Enter a temperature in degrees Fahrenheit: 72
72 degrees Fahrenheit = 22.2 degrees Celsius.