Starting Out with Java: Early Objects (6th Edition)
6th Edition
ISBN: 9780134462011
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3.1, Problem 3.1CP
In this chapter, we use the metaphor of a blueprint and houses that are created from the blueprint to describe classes and objects. In this metaphor, are classes the blueprint or the houses?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create your own UML diagram — similar to the above UML diagram — for a Pet class that meets thespecification below.1. Create the fields indicated below. Use these names exactly as given for your fields. Define them inexactly this order.• name — The name of the pet, e.g., “Rufus”, “Mittens”, “Smelly”, etc.• animal — The type of pet, e.g., “dog”, “cat”, “asparagus”, etc.• age — The (integer) number of years the pet has been alive, e.g., 1, 2, 3, etc.2. Create a mutator for each of the above in the order listed. Use the standard Java naming conventionfor mutators.3. Create an accessor for each of the above in the order listed. Use the standard Java naming conventionfor accessors.Example: Suppose you are taking the question for the example Car UML above instead of your Pet UML.Don’t enter any spaces at all.When the question asks: Enter line 1:You would enter: CarWhen the question asks: Enter line 2:You would enter: -make:StringWhen the question asks: Enter line 3:You would enter:…
In a university there are different classrooms, offices and departments. A
department has a name and it contains many offices. A person working at the
university has a unique ID and can be a professor or an employee.
"A professor can be a full, associate or assistant professor and he/she is enrolled
in one department.
•Offices and classrooms have a number ID, and a classroom has a number of seats.
• Every employee works in an office.
1.
Draw the class diagram for the scenario above
See the class diagram (UML2.0) and the relationship between classes Person and Professor. What sentence describes this relationship correctly?
Select one:
a. The relationship links two classes. The relationship represents a generalization and specialization princip. One class is representing a general description and the second one is more detailed.
b. The relationship links two classes. The relationship is weak and instances of classes are not affected by destroying instance on the other side of relationship.
c. The relationship links two classes. The relationship is weak and when the container class instance is destroyed the contents class instatnce is not destroyed.
d. The relationship links two classes. The relationship is very strong and when the container class instance is destroyed the contents class instatnce is destroyed too.
Chapter 3 Solutions
Starting Out with Java: Early Objects (6th Edition)
Ch. 3.1 - In this chapter, we use the metaphor of a...Ch. 3.1 - Prob. 3.2CPCh. 3.1 - When a variable is said to reference an object,...Ch. 3.1 - A string literal, such as Joe, causes what type of...Ch. 3.1 - Prob. 3.5CPCh. 3.1 - Prob. 3.6CPCh. 3.1 - Prob. 3.7CPCh. 3.1 - Prob. 3.8CPCh. 3.1 - Prob. 3.9CPCh. 3.1 - What is a stale data item?
Ch. 3.3 - Assume that r1 and r2 are variables that reference...Ch. 3.4 - How is a constructor named?Ch. 3.4 - What is a constructors return type?Ch. 3.4 - Prob. 3.14CPCh. 3.8 - Prob. 3.15CPCh. 3.8 - When designing an object-oriented application, who...Ch. 3.8 - How do you identify the potential classes in a...Ch. 3.8 - What are a classs responsibilities?Ch. 3.8 - What two questions should you ask to determine a...Ch. 3.8 - Will all of a classs actions always be directly...Ch. 3 - This is a collection of programming statements...Ch. 3 - A class is analogous to a(n) _______. a. house b....Ch. 3 - An object is a(n) _____. a. blueprint b. attribute...Ch. 3 - This is a class member that holds data. a. method...Ch. 3 - This key word causes an object to be created in...Ch. 3 - This key word causes a value to be sent back from...Ch. 3 - This is a method that gets a value from a classs...Ch. 3 - This is a method that stores a value in a field or...Ch. 3 - When the value of an item is dependent on other...Ch. 3 - This is a method that is automatically called when...Ch. 3 - When a local variable has the same name as a...Ch. 3 - If you do not write a constructor for a class,...Ch. 3 - A classs responsibilities are __________. a. the...Ch. 3 - Prob. 14TFCh. 3 - True or False: When passing an argument to a...Ch. 3 - Prob. 16TFCh. 3 - True or False: Each instance of a class has its...Ch. 3 - True or False: When you write a constructor for a...Ch. 3 - True or False: To find the classes needed for an...Ch. 3 - Find the error in the following class: public...Ch. 3 - Prob. 2FTECh. 3 - The following statement attempts to create a...Ch. 3 - Design a class named Pet, which should have the...Ch. 3 - Look at the following partial class definition,...Ch. 3 - Look at the following description of a problem...Ch. 3 - What is the difference between a class and an...Ch. 3 - A contractor uses a blueprint to build a set of...Ch. 3 - What is an accessor method? What is a mutator...Ch. 3 - is it a good idea to make fields private? Why or...Ch. 3 - If a class has a private field, what has access to...Ch. 3 - Prob. 6SACh. 3 - Assume a program named MailList.java is stored in...Ch. 3 - Prob. 8SACh. 3 - Why are constructors useful for performing...Ch. 3 - Prob. 10SACh. 3 - What is the difference between an argument and a...Ch. 3 - Under what circumstances does Java automatically...Ch. 3 - What do you call a constructor that accepts no...Ch. 3 - Employee Class Write a class named Employee that...Ch. 3 - Car Class Write a class named Car that has the...Ch. 3 - Personal Information Class Design a class that...Ch. 3 - Temperature Class Write a Temperature class that...Ch. 3 - Retail Item Class Write a class named RetailItem...Ch. 3 - Payroll Class Design a Payroll class that has...Ch. 3 - TestScores Class Design a TestScores class that...Ch. 3 - Circle Class Write a Circle class that has the...Ch. 3 - Pet Class Design a class named Pet, which should...Ch. 3 - Patient Charges Write a class named Patient that...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What is a class specification file? What is a class implementation file?
Starting Out with C++ from Control Structures to Objects (8th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
This enum method returns the position of an enum constant in the declaration. a. position b. location c. ordina...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Suppose your program contains type definitions and pointer variable declarations as in Self-Test Exercise 7. Su...
Problem Solving with C++ (10th Edition)
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (8th Edition)
Indentify and correct the errors in each of the following. [Note: There may be more than one error in each piec...
C How to Program (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- With the aid of examples, demonstrate what you understand about a class and its instances.arrow_forwardPlease draw a class diagram which reflects the following information: A student can be undergraduate or a graduate student. An undergraduate student can be a type of tutor. A tutor tutors a student. A teacher and a professor are two types of instructors. A teacher assistant can assist a teacher and a professor, but a teacher can be assisted by only one assistant, while a professor can be assisted by up to five assistants. A teacher assistant is a type of graduate student.arrow_forwardFor the diagram, are the classes "Sphere", "Cone", and "Cylinder" under the class "Shape"? And then the class "shapeArray" is under those classes? Is that how they all relate to one another? I have attached a rough UML diagram for clarity as to what I am trying to describe.arrow_forward
- 1: There are common attributes and methods between kids and trainers. What is the bestchoice for designing and writing the codes of these two classes? Explain your answer.2: Draw a simple class diagram showing only relationships between the classesarrow_forwardDesign classes to represent the following “things” in the given enterprises. For each one, describe the class in English, then draw the UML class diagram containing a few obvious natural attributes. A work of art, displayed in a gallery or museum. An automobile, registered with the Motor Vehicle Department. A pizza, that is on the menu at a restaurant. Deliverables A document containing your answers to the three classes above, either hand-drawn or created with a computer.arrow_forwardI need to draw a class diagram for problem described here: Five philosophers are sitting at a circular table sharing a meal. A fork is placed between each pair of philosophers and each philosopher needs two forks to eat, which means no two neighbours may be eating simultaneously.arrow_forward
- Make the class diagram using the classes given below. Add relationships and multiplicities in each of them. a) School, Playground, principal, school board, classroom, book, student, teacher, cafeteria, restroom, computer, desk, chair, door, swing b) Automobile, engine, wheel, brake, brake light, door, battery, muffler, tail pipe c) Page, shape, point, line, arc, ellipse, rectangle, circle d) City, Airport, Airline, Pilot, Flight, Plane, Seat, Passenger Computer science Topic : structural modelling. Class diagram You can use the association types where needed in the diagram - aggregation, composition and dependancyarrow_forwardA class and an object example are provided. Define classes, objects, and the relationships between them. Use real-world examples to help explain your points.arrow_forwardI want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?arrow_forward
- Overview: The Observer Design Pattern is a way to design a subsystem that allows many objects to respond automatically to changes of a particular object that's being "observed". Task: Let's say that we have a bank system and this is a main branch (observed class) and there are three branch of bank (concrete class) where is notification supposed to receive by each of those branch notifySubscribers() method. Objectives: • Create a Class UML Diagrams using the Design Patterns showing the Observer Design Pattern. In java code, Create classes and all attributes and methods for the classes.arrow_forward9. Draw Class diagram for, customer order from a retail catalog. The central class is the Order. Associated with it are the Customer making the purchase and the Payment. A Payment is one of three kinds: Cash, Check, or Credit. The order contains OrderDetails (line items), each with its associated Item.arrow_forwardCreate a class diagram for the Indiana University library.The Indiana University library has books, journals, and the daily newspaper. These are the things from the library. Every piece of library material is labeled with an id number and a title. Only books are available for loan to Indiana University students and faculty members, out of the whole collection. Staff members can borrow periodicals to use for their research projects. IU users (staff and students) who wish to borrow books must have their ID cards scanned by the librarian, who must then keep track of the borrower's ID, the loan date, and when the book is due back. The library keeps track of the names, ID numbers, and phone numbers of its patrons. Every user is issued a library card. Create a class diagram based on the information provided above. Please make sure that you display traits, multiplicities, and relationships when applicable.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY