Education  >  SOLUTIONS MANUAL  >  Solutions Manual For A Comprehensive Introduction to Object-Oriented Programming with Java, 1e C. Th (All)

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

Document Content and Description Below

Solutions Manual For A Comprehensive Introduction to Object-Oriented Programming with Java, 1e C. Thomas Wu-Suppose the Vehicle class in Exercise 1 is used in a program that keeps track of vehicle re ... gistration 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 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. Instance variables name address phoneNumber numClassesThisSemester totalCreditHours Class variables 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 different types of students. Relate the classes using inheritance. Student See Exercise 1.6 GraduateStudent (subclass of Student) 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 1.8 Imagine you are given a task of designing an airline reservation system that keeps track of flights for a commuter airline. List the classes you think would be necessary for designing such a system. Describe the data values and methods you would associate with each class you identify. Note: For this exercise and Exercises 9 through 12, we are not expecting you to design the system in complete detail. The objective of these exercises is to give you a taste of thinking about a program at a very high level. Try to identify about a half dozen or so classes, and for each class, describe several methods and data members. Database Data Members Collection of clients Collection of flights Methods Accessors (get ()) and Mutators (set __ ()) for clients and flights1 Make reservation Add new flight Client Data Members Name Address Phone Collection ofreservations BillingInformation Methods Accessors and Mutators for name, address, BillingInformation, and collection of reservations Add reservation Flight Data Members Departure city Arrival city Departure time Arrival time Seats available Aircraft type 1 Accessors and Mutators (also called gets and sets) allow other people to use your classes data members while allowing you to control just how they access them. This allows you to perform various activities like bounds checking (making sure the value set is not illegal, such as –6 for an age data member). This is part of the concept of encapsulation and is fundamental to the object-oriented paradigm. [Show More]

Last updated: 9 months ago

Preview 5 out of 184 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Loading document previews for Solutions Manual For A Comprehensive Introduction to Object-Oriented Programming with Java, 1e C. Thomas Wu

Loading document previews ...

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$14.50

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

31
0

Document information


Connected school, study & course


About the document


Uploaded On

Mar 27, 2025

Number of pages

184

Written in

All

Seller


Profile illustration for LAVIE
LAVIE

Member since 4 years

10 Documents Sold

Additional information

This document has been written for:

Uploaded

Mar 27, 2025

Downloads

 0

Views

 31


$14.50
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·