When visitors come to dinner Mr. Smith always makes them Danish Apple Cake. For four people this requires the following ingredients:
Write a program that inputs the number of people coming to dinner and then prints the amount of each ingredient required. Round all of your output values down to an integer. (For example, you should print 100.6 as 100.)
To help you get started, we have provided a ``skeleton'' program. See ``cake.f'' in your ``examples'' directory (or view it directly). Don't forget to use ``IMPLICIT NONE'' in your program.
When you are finished, call a TA over to take a look at your program. If your program is correct, the TA will check you off. And be sure to save your program when you are done. You will modify it in the checkoff portion of the next lesson.
Homework Problem 1
Write a program that inputs 7 integers and prints out their arithmetic
and geometric means, as real numbers, and then round your results down
to the nearest integer. [Hint: Arithmetic mean = average; geometric mean
of n positive numbers
is
.]
Your program should print out ``Data Error'' if one of the integers
input is negative.
Call the file that contains your program solution1.f. To submit it for grading, use the UNIX Shell window to connect to the directory that contains your program and enter the following command:
handin cs101 problem-1 solution1.f
Some Useful Information
Here is some information that you may find useful as the quarter proceeds:
checkgrades cs101
in your Unix Shell window.
handin cs101 problem-1
Of course, you should use a different problem name if you aren't interested in problem one.
Correctness: 60%. Does your program compute the right results and fulfill all of its requirements?
Style: 40%. Is your program well commented? Is it indented in a structured way? Does it communicate with the user via input/output in a helpful way? Are meaningful variable names used? You should refer to examples from the lessons and the textbooks, and pay attention to TA feedback, to gain an appreciation for good programming style. The grading in this department will become more exacting as you learn more and the TAs begin to expect more of you.
Hamlet Project