100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Solutions Manual For A Comprehensive Introduction to Object-Oriented Programming with Java, 1e C. Thomas Wu||ISBN:9780073317083

Rating
-
Sold
-
Pages
184
Grade
A+
Uploaded on
30-12-2025
Written in
2025/2026

Solutions Manual For A Comprehensive Introduction to Object-Oriented Programming with Java, 1e C. Thomas Wu||ISBN:9780073317083

Institution
A Comprehensive Introduction To Object-Oriented Pr
Module
A Comprehensive Introduction to Object-Oriented Pr











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
A Comprehensive Introduction to Object-Oriented Pr
Module
A Comprehensive Introduction to Object-Oriented Pr

Document information

Uploaded on
December 30, 2025
Number of pages
184
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

MEDSTUDY.COM




Solutions Manual For A
Comprehensive Introduction
to Object-Oriented
Programming with Java, 1e C.
M

Thomas Wu
ED
ST
U
D
Y

,MEDSTUDY.COM
Chapter 1 Solutions

1.1 Graphically represent a Vehicle class and three Vehicle objects named car1, car2,
and car3.


Vehicle




car1:Vehicle car2:Vehicle car3:Vehicle
M

1.2 Graphically represent a Person class with the following components:
• Instance variables name, age, and gender.
ED
• Instance methods setName, getName, and getAge.
• Class method getAverageAge.

Person
setName()
ST
name
getAge()
age age

getGender() gender
U
gender

getAverageAge()
D
average age
Y
1.3 Design a CD class where a CD object represents a single music CD. What kinds
of information (artist, genre, total playing time, etc.) do you want to know about a
CD? Among the information in which you are interested, which are instance
variables? Are there any class variables or class constants?

State
Album Name instance variable
Artist instance variable
Genre instance variable
Total Playing Time instance variable
Maximum Playing Time class constant

,MEDSTUDY.COM


Behaviors
getAlbumName(), setAlbumName() instance methods
getArtist(), setArtist() instance methods
getGenre(), setGenre() instance methods
getPlayingTime(), setPlayingTime() instance methods
getMaxPlayingTime() class method

Students may also include a list of songs on the CD and methods to access them.
A song itself would probably have its own class to represent it. However this
concept is more advanced than is necessary at this stage.

1.4 Suppose the Vehicle class in Exercise 1 is used in a program that keeps track of
vehicle registration for the Department of Motor Vehicles. What kinds of
instance variables would you define for such Vehicle objects? Can you think of
M
any useful class variables for the Vehicle class?

Instance variables
ED
owner
licenseID
registrationNumber
make
model
color
ST
value

Class variables
At this stage, the number of total vehicles could be thought to belong to
the class. Information relating to the length of a licenseID or
U
registrationNumber could be stored as class constants. Aside from these,
there are no obviously necessary traits for which all vehicles share the
same value or which the class may need to function.
D
1.5 Suppose the following formulas are used to compute the annual vehicle
registration fee for the vehicle registration program in Exercise 1.4:
Y
• For cars, the annual fee is 2 percent of the value of the car.
• For trucks, the annual fee is 5 percent of the loading capacity (in
pounds) of the truck.
Define two new classes Car and Truck as subclasses of Vehicle.
Hint: Associate class and instance variables common to both Car and Truck to
Vehicle.

Vehicle Class
See Exercise 1.4

Car Class (subclass of Vehicle)
registrationRate class constant

, MEDSTUDY.COM


Note: Value is already an instance variable in Vehicle since all vehicles
have some value.

Truck Class (subclass of Vehicle)
registrationRate class constant
loadingCapacity instance variable

1.6 Consider a student registration program used by the registrar’s office. The
program keeps track of students who are registered for a given semester. For each
student registered, the program maintains the student’s name, address, and phone
number; the number of classes in which the student is enrolled and the student’s
total credit hours. The program also keeps track of the total number of registered
students. Define instance and class variables of a Student class that is suitable for
this program.
M

Instance variables
name
ED
address
phoneNumber
numClassesThisSemester
totalCreditHours

Class variables
ST
numStudentsRegistered

1.7 Suppose the minimum and maximum number of courses for which a student can
register are different depending on whether the student is a graduate,
undergraduate, or work-study student. Redo Exercise 6 by defining classes for
U
different types of students. Relate the classes using inheritance.

Student
D
See Exercise 1.6

GraduateStudent (subclass of Student)
Y
maximumHours class constant
minimumHours class constant

UndergraduateStudent (subclass of Student)
maximumHours class constant
minimumHours class constant

WorkStudyStudent (subclass of Student)
maximumHours class constant
minimumHours class constant

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MedStudy Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
21
Member since
5 months
Number of followers
0
Documents
1025
Last sold
8 hours ago
Welcome to MedStudy on Stuvia!

Unlock academic success with high-quality, student-approved study materials. My shop offers well-structured, easy-to-understand notes, summaries, exam guides, and assignments tailored to help you ace your courses with confidence. Whether you\\\'re preparing for finals or just need a quick refresher, you\\\'ll find reliable, up-to-date resources here—created with clarity, accuracy, and real student needs in mind. Subjects covered: [Nursing, Business, Accounting, Mathematics, Biology, etc...] .Verified content .Clear explanations & key exam tips . Instant digital download Start learning smarter—browse my notes today!

Read more Read less
5.0

2 reviews

5
2
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions