Java Reference
In-Depth Information
Exercise R12.11. Draw a UML diagram for the
Coin
and
CashRegister
classes described in
Section 8.2
.
Exercise R12.12. A file contains a set of records describing countries.
Each record consists of the name of the country, its population, and its
area. Suppose your task is to write a program that reads in such a file and
prints
ȗ
The country with the largest area
ȗ
The country with the largest population
ȗ
The country with the largest population density (people per square
kilometer)
Think through the problems that you need to solve. What classes and
methods will you need? Produce a set of CRC cards, a UML diagram,
and a set of
javadoc
comments.
Exercise R12.13. Discover classes and methods for generating a student
report card that lists all classes, grades, and the grade point average for a
semester. Produce a set of CRC cards, a UML diagram, and a set of
javadoc
comments.
Exercise R12.14. Consider a quiz grading system that grades student
responses to quizzes. A quiz consists of questions. There are different
types of questions, including essay questions and multiple-choice
questions. Students turn in submissions for quizzes, and the grading
system grades them. Draw a UML diagram for classes
Quiz
,
Question
,
EssayQuestion
,
MultipleChoiceQuestion
,
Student
, and
Submission
.
Additional review exercises are available in WileyPLUS.
PROGRAMMING EXERCISES
Exercise P12.1. Enhance the invoice-printing program by providing for
two kinds of line items: One kind describes products that are purchased in