COP 1510 Programming
Concepts I
Assignment 8
Name________________________________________
Section_______________________________________
Date__________________________________________
1. Review Questions 1--55, pp. 301--303
2. Problem 2 p. 306 (Distance Traveled)
3. Problem 4 p. 307 (Math Tutor)
4. Problem 6 p. 307 (Average Rainfall)
5. Problem 9 p. 308 (Smallest and Largest)
Input
should come from a file.
6. A Perfect Number is one that is equal to
the sum of its divisors, other than itself.
Six is the first Perfect Number since 6 = 1 + 2 + 3. The ancient Greeks attached mystical
significance to such numbers. In the
first century A.D. the numbers were separated into abundant (sum of the
divisors is greater than the number, e, g, 12 is abundant since 1 + 2 + 3 + 4 +
6 > 12) and deficient (sum of the divisors is less than the number, e.g. 9
is deficient since 1 + 3 < 9). Write
a program to list the integers from 1 to 100 and classify each as Perfect,
Abundant, or Deficient.
7. Determine the number of years required
for an investment to double in value.
Input should be the amount invested P and interest rate R. Assuming that interest is compounded once a
year, the formula for determining the amount of an investment A after N
years is
A = P(1
+ R)N
For
all programming problems, follow the directions for comments at the top of
p. 306. Submit a printout of the program
and proof of testing as described in class.
Attach
this cover sheet to your work.