100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
SOLUTION MANUAL FOR A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PRORAMMING WITH JAVA 1ST EDITION BY C THOMAS WU $24.49   Add to cart

Other

SOLUTION MANUAL FOR A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PRORAMMING WITH JAVA 1ST EDITION BY C THOMAS WU

 4 views  0 purchase
  • Course
  • A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PR
  • Institution
  • A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PR

SOLUTION MANUAL FOR A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PRORAMMING WITH JAVA 1ST EDITION BY C THOMAS WU

Preview 4 out of 186  pages

  • May 13, 2024
  • 186
  • 2024/2025
  • Other
  • Unknown
  • A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PR
  • A COMPREHENSIVE INTRODUCTION TO OBJECT ORIENTED PR
avatar-seller
Succeed
, SOLUTION MANUAL FOR A COMPREHENSIVE
INTRODUCTION TO OBJECT ORIENTED PRORAMMING
WITH JAVA 1ST EDITION BY C THOMAS WU

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




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

Person
setName()
name
getAge()
age age

getGender() gender
gender

getAverageAge()
average age


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

, 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
any useful class variables for the Vehicle class?

Instance variables
owner
licenseID
registrationNumber
make
model
color
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
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.

1.5 Suppose the following formulas are used to compute the annual vehicle
registration fee for the vehicle registration program in Exercise 1.4:
• 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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Succeed. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $24.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79978 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$24.49
  • (0)
  Add to cart