Complete instructor’s solutions manual for C. Thomas Wu’s Java OOP textbook., Exams of Java Programming

Complete instructor’s solutions manual for C. Thomas Wu’s Java OOP textbook. Covers all chapters from basics (classes, objects, inheritance) to advanced topics (GUIs with Swing/AWT, arrays, sorting/searching, recursion, file I/O, collections framework, applets, and event handling). Includes hundreds of fully-solved programming exercises, design documents, state-of-memory diagrams, and complete Java source code files. Ideal for instructors and students seeking verified, A+ grade solutions.

Typology: Exams

2025/2026

Available from 04/20/2026

Premiumexambank
Premiumexambank 🇺🇸

698 documents

1 / 185

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
A Comprehensive Introduc�on
to Object-Oriented
Programming with Java, 1e C.
Thomas Wu (Solu�ons Manual
All Chapters, 100% Original
Verified, A+ Grade)
All Chapters Solu�ons Manual
Supplement files download
link at the end of this file.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Complete instructor’s solutions manual for C. Thomas Wu’s Java OOP textbook. and more Exams Java Programming in PDF only on Docsity!

A Comprehensive Introduc�on

to Object-Oriented

Programming with Java, 1e C.

Thomas Wu (Solu�ons Manual

All Chapters, 100% Original

Verified, A+ Grade)

All Chapters Solu�ons Manual

Supplement files download

link at the end of this file.

1.1 Graphically represent a Vehicle class and three Vehicle objects named car1, car2, and car3. 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. 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 Vehicle car1:Vehicle car2:Vehicle car3:Vehicle Person name age gender setName() getAge() age getGender() gender getAverageAge() average age Chapter 1 Solutions

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. 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 flights^1 Make reservation Add new flight Client Data Members Name Address Phone Collection of reservations 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.

Course Data Members Collection of Sections Title Code College Department Methods Add Section Remove Section Accessors and Mutators for all data members Section Data Members Maximum number of students Current number of students Section ID Methods Add Student Remove Student Accessors and Mutators for all data members 1.10 Repeat Exercise 8, designing the state Department of Motor Vehicles registration system. The system keeps track of all licensed vehicles and drivers. How would you design objects representing different types of vehicles (e.g., motorcycles and trucks) and drivers (e.g., class A for commercial licenses and class B for towing vehicles)? Vehicle Data Members VIN Class type (A, B, etc.) Make Model Year Registration fee Owner Methods Accessors and Mutators for all data members Note: Could also implement with several subclasses of Vehicle, one for each class (car, commercial truck, livery, etc.) especially if each type required some specialized information.

Driver Data Members License number Name Address Collection of Vehicles Collection of Violations Methods Add Vehicle/Violation Remove Vehicle/Violation Accessors and Mutators for all data members Violation Data Members Number Date Location Charge Officer Methods Accessors and Mutators for all data members 1.11 Repeat Exercise 8, designing a sales tracking system for a fast-food restaurant. The system keeps track of all menu items offered by the restaurant and the number of daily sales per menu item. Menu Data Members Collection of menu items Total Sales Methods Get Menu Item Add Menu Item Delete Menu Item MenuItem Data Members Name Price Total Sales Methods Accessors and Mutators for name, price, and total sales

Number of free withdrawals Fee per withdrawal Interest Rate Check writing privileges Debit Card information 1.14 Consider a program that maintains an address book. Design an inheritance hierarchy for the classes such as Person, ProfessionalContact, Friend, and Student that can be used in implementing such a program. Account Savings Account Checking Account Money Market Account Student Checking Classic Checking Business Checking

1.15 Do you think the design phase is more important than the coding phase? Why or why not? The design phase is much more important than the coding phase. Design has a huge impact on not only the ease and speed of implementation during the coding phase but also on the testing and maintenance phases. A proper design allows testing to be done in terms of structural components, which makes bugs easier to trace back to the improper implementation. Furthermore, a good design is far more maintainable. Maintenance is considered the most expensive of all the phases, thus a more easily maintained project is considerably less expensive. It is important to remember that maintenance includes more than just fixing bugs; extension of the original design to meet new requirements is a common and important task. 1.16 How does the quality of design affect the total cost of developing and maintaining software? A low quality design will not only slow implementation, thus increasing expense and delay, but will also force design decisions to be revisited later. Inevitably, the design will have to change. Related implementation will have to be adapted or recoded. Testing will have to be redone. The more patchwork done, the more likely new errors are injected into the code. Not only are the maintenance programmers burdened with what is almost certainly a less coherent design (and documentation that tended to become outdated as more changes to the design were made), but they must also hunt for more bugs.

} }

1. Should be /* _to begin a multi-line comment

  1. Should be_ */ _to terminate a multi-line comment
  2. The correct package name is_ javax.swing _Java is case sensitive.
  3. The correct declaration for the main method is_ public static void main(String[] args) 5. When declaring a variable, the type comes before the variable name. The correct statement is: JFrame myFrame; 6. The setVisible method requires a boolean parameter. The correct statement is: myFrame.setVisible(true);
  4. Identify all errors in the following program: /* Program Exercise Attempting to display the number of characters in a given input. /  1 class three { public static void main( ) {  2 String input; input = JOptionPane(“input:”);  3 JOptionPane.showMessageDialog( null,“Input has ”+ input.length() + “ characters”); } } 1. JOptionPane is defined in the javax.swing package. In order to use JOptionPane we must import javax.swing. We must insert the following statement import javax.swing.; or import javax.swing.JOptionPane; 2. The correct declaration for the main method is public static void main(String[] args) 3. In order to get user input from a JOptionPane , we must use the showInputDialog method. The correct statement is: input = JOptionPane.showInputDialog(null, “input:”);
  5. Describe the purpose of comments. Name the types of comments available. Can you include comment markers inside a comment?

Purposes: To describe the program, methods, data values, and other components To explain the meaning of code To provide other helpful information to improve the readability Types: Multi-line comments Single-line comments Javadoc comments In some cases yes (like including // in a multi-line comment), but in other cases no.

  1. What is the purpose of the import statement? Does a Java program always have to include an import statement? Imports allow us to use or refer to classes in the imported package without having to use the fully qualified class name. Import statements are not always required. For example, any classes in the java.lang package can be used without importing. If we use fully qualified names in our program, the import statements are not necessary.
  2. Show the syntax for importing one class and all classes in a package. One class: import .; All classes: import .*;
  3. Describe the class that must be included in any Java application. Every java application requires one class to be designated as its main class. The designated main class must include the main method.
  4. What is a reserved word? List all the Java reserved words mentioned in this chapter. A reserved word is an identifier that is reserved by a programming language and used for a specific purpose. It can be used to designate a special operator such as new or syntactical element of the language such as class and public. Reserved words introduced in this chapter are new, import, class, public, static, void , true , false , and null.
  5. Which of the following are invalid Java identifiers? a. R2D2 g. 3CPO b. Whatchamacallit h. This is okay.

Get complete Order files download link

below

htps://www.mediafire.com/file/hiv6tkbgaqyvy3v/SM+

A+Comprehensive+Introduc�on+to+Object-

Oriented+Programming+with+Java,+1e+C.+Thomas+W

u.zip/file

If this link does not work with a click, then

copy the complete Download link and

paste link in internet

explorer/firefox/google chrome and get all

files download successfully.

myFrame = new JFrame();

  1. Show a state-of-memory diagram after each of these statements is executed: JFrame window1; Resident res1, res2; window1 = new JFrame(); res1 = new Resident(); res2 = new Resident(); After 3 objects are declared: After 3 new operations are executed:
  2. Show a state-of-memory diagram after each of these statements is executed: Person person1, person2;
  1. Which of these identifiers violate the naming convention for class names? a. r2D2 e. CPO b. whatchamacallit f. ThisIsReallyOkay c. Java g. java d. GoodName h. badName The convention is to use an uppercase letter for the first character. The first character of a new word is also capitalized. All other letters are lowercase. The identifiers a , b , g , and h violate the convention. The identifier CPO should be considered as valid if it is interpreted as some kind of acronym.
  2. Which of these identifiers violate the naming convention for object names? a. R2D2 e. 3CPO b. isthisokay? f. ThisIsReallyOkay c. Java g. java d. goodName h. anotherbadone The convention for object names is almost identical to the one for class names, except the first character is lowercase. The identifiers a , b , c , e , f , and h violate the convention. Notice that b and e are not even valid identifiers.
  3. For each of these expressions determine its result. Assume the value of text is a string Java Programming. String text = “Java Programming”; a. text.substring(0, 4) b. text.length( ) c. text.substring(8, 12) d. text.substring(0, 1) + text.substring(7, 9) e. text.substring(5, 6) + text.substring(text.length() – 3, text.length()) a. Java b. 16

c. gram d. Jog e. Ping

  1. Write a Java application that displays today’s date in this format: Sunday November 10, 2002. See Exercise2_17.java
  2. Write a Java application that displays a frame window 300 pixels wide and 200 pixels high with the title My First Frame. Place the frame so that its top, left corner is at a position 50 pixels from the top of the screen and 100 pixels from the left of the screen. To position a window at a specified location, you use the setLocation method, as in //assume mainWindow is declared and created frame.setLocation( 50, 50 ); Through experimentation, determine how the two arguments in the setLocation method affects the positioning of the window. See Exercise2_18.java
  3. Write a Java application that displays the two messages I Can Design and And I Can Program , using two separate dialogs. See Exercise2_19.java
  4. Write a Java application that displays the two messages I Can Design and And I Can Program , using one dialog but in two separate lines. See Exercise2_20.java
  5. Write a Java application that displays a very long message. Try a message that is wider than the display of your computer screen, and see what happens. See Exercise2_21.java
  6. Because today’s computers are very fast, you will probably not notice any discernable difference on the screen between the code JFrame myWindow; myWindow = new JFrame( ); myWindow.setVisible( true ); and