100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Examen

Solution Manual for Comprehensive Introduction to Object Oriented Programming with Java 1st Edition Thomas Wu, (Chapter 1 - 15 ) Latest Guide

Puntuación
-
Vendido
-
Páginas
185
Grado
A+
Subido en
12-04-2025
Escrito en
2024/2025

Solution Manual for Comprehensive Introduction to Object Oriented Programming with Java 1st Edition Thomas Wu, (Chapter 1 - 15 ) Latest Guide

Institución
Comprehensive Introduction To Object Oriented Prog
Grado
Comprehensive Introduction to Object Oriented Prog

Vista previa del contenido

Solution Manual

Comprehensive Introduction To Object Oriented
Programming With Java
By Thomas Wu,


1st Edition

, 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
Mode
l
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

Libro relacionado

Escuela, estudio y materia

Institución
Comprehensive Introduction to Object Oriented Prog
Grado
Comprehensive Introduction to Object Oriented Prog

Información del documento

Subido en
12 de abril de 2025
Número de páginas
185
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$15.49
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Examarena West Virginia University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
329
Miembro desde
2 año
Número de seguidores
33
Documentos
481
Última venta
4 días hace
Examarena

Are you looking for top-quality study resources to help you excel in your courses? Look no further! I’ve uploaded my carefully crafted notes, assignments, and exam guides to help you master your studies. Don’t miss out on better grades. email me and start using my materials today and feel the difference!

3.4

46 reseñas

5
13
4
10
3
11
2
5
1
7

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes