8.9 Exercises


8.9 Exercises

  1. Rewrite the KJP code that implements class Sum, which computes the summation of a series of numbers. The program should consist of at least two classes.

  2. Rewrite the KJP program that includes class Max, which computes the maximum value of a list of numbers. The program should consist of at least two classes.

  3. Write the algorithm in informal pseudo-code and KJP code for a program that is to calculate the average of a series of input values.

  4. Write the complete algorithm and the KJP code for a program that finds the minimum value from a series of input values.

  5. Rewrite the KJP code for Exercise 1, with a different loop statement.

  6. Modify the algorithm and the KJP program of the salary problem. The algorithm should compute the average increase using 5.5% and 6% salary increases.

  7. Write the algorithm and KJP code for a program that reads the grade for every student, determines his letter grade, and calculates the overall group average, maximum, and minimum grade.

  8. Write the algorithm in informal pseudo-code and the KJP implementation of a program that reads rainfall data in inches for yearly quarters, for the last five years. The program should compute the average rainfall per quarter (for the last five years), the average rainfall per year, and the maximum rainfall per quarter and for each year.

  9. Write the algorithm in informal pseudo-code and the KJP implementation of a program that calculates the volume of several spheres. For each sphere, the program should compute the volume. Before termination, the program should compute and display the average volume for all the spheres. After computing the volume of a sphere, the program asks the user if he wants to continue.

  10. Write the algorithm in informal pseudo-code and the KJP implementation of a program that reads data for every inventory item code and calculates the total value (in dollars) for the item code. The program should also calculate the grand total of inventory value. The number of inventory data to read is not known, so the program should continue reading data until the user replies that there are no more inventory items to process. Every item includes: item code, item description, the number of items of that code in stock, and the amount for the unit value.




Object-Oriented Programming(c) From Problem Solving to Java
Object-Oriented Programming (From Problem Solving to JAVA) (Charles River Media Programming)
ISBN: 1584502878
EAN: 2147483647
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net