Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 14.2, Problem 14.6CP
In this chapter, we use the metaphor of a cookie cutter and cookies that are made from the cookie cutter to describe classes and objects. In this metaphor, are objects the cookie cutter, or the cookies?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Suppose a parent class has a few methods that the child would like to use, but the methods are not appropriate for the child. What can the child do to make the methods 'usable' for itself?
Write classes that could be used in a system that manages vehicles in a public transportation system.
You will write classes to represent a TransitVehicle, Bus, and SubwayCar. The information about the classes is below.
Step 1: Plan Your Class Design
Before you start to code, decide how to design your classes. Which class should be the parent? the child? What variables or methods belong in each class?
Step 2: Write the Core Class Components
Write the three classes. Each class must have all of the following.
Important: a class can have a method directly (meaning written into the code) or indirectly (meaning inherited from a parent). Either of these counts to meet the requirement.
instance data variables
transit vehicles are described by an id that contains letters and numbers and a description of the route
buses are described by an id, route, and the number of miles per gallon (without decimals)
subway cars are described by an id, route, and whether or not the car goes underground…
Write the missing code in the dark picture. This is not graded
Chapter 14 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Ch. 14.1 - What is an object?Ch. 14.1 - Prob. 14.2CPCh. 14.1 - Prob. 14.3CPCh. 14.1 - What are public methods? What are private methods?Ch. 14.2 - You hear someone make the following comment: A...Ch. 14.2 - In this chapter, we use the metaphor of a cookie...Ch. 14.2 - Prob. 14.7CPCh. 14.2 - Prob. 14.8CPCh. 14.2 - When a class variable is said to reference an...Ch. 14.2 - Prob. 14.10CP
Ch. 14.2 - Prob. 14.11CPCh. 14.2 - What is a constructor? When does a constructor...Ch. 14.2 - What is a default constructor?Ch. 14.3 - Prob. 14.14CPCh. 14.3 - Suppose a class has a field named description. The...Ch. 14.3 - Prob. 14.16CPCh. 14.4 - Prob. 14.17CPCh. 14.4 - What technique was described in this section for...Ch. 14.4 - What are classes responsibilities?Ch. 14.4 - Prob. 14.20CPCh. 14.5 - In this section, we discussed superclasses and...Ch. 14.5 - Prob. 14.22CPCh. 14.5 - What does a subclass inherit from its superclass?Ch. 14.5 - Look at the following pseudocode; which is the...Ch. 14.6 - Look at the following pseudocode class...Ch. 14 - Prob. 1MCCh. 14 - Prob. 2MCCh. 14 - A(n) ____ is a member of a class that holds data....Ch. 14 - The _________ specifies how a classs field or...Ch. 14 - A classs fields are commonly declared with the...Ch. 14 - Prob. 6MCCh. 14 - In many programming languages, the _____ key word...Ch. 14 - A(n) ____ method gets a value from a class's field...Ch. 14 - A(n) ____ method stores a value in a field or...Ch. 14 - A(n) ____ method is automatically called when an...Ch. 14 - A set of standard diagrams for graphically...Ch. 14 - When the value of an item is dependent on other...Ch. 14 - A classs responsibilities are _____. a. objects...Ch. 14 - In an inheritance relationship, the _____ is the...Ch. 14 - In an inheritance relationship, the _____ is the...Ch. 14 - The ___________ characteristic of object-oriented...Ch. 14 - The practice of procedural programming is centered...Ch. 14 - Object reusability has been a factor in the...Ch. 14 - It is a common practice in object-oriented...Ch. 14 - One way to find the classes needed for an...Ch. 14 - The superclass inherits fields and methods from...Ch. 14 - Polymorphism allows a class variable of the...Ch. 14 - Prob. 1SACh. 14 - Prob. 2SACh. 14 - What is the difference between a class and an...Ch. 14 - In many programming languages, what does the New...Ch. 14 - The following pseudocode statement calls an...Ch. 14 - Prob. 6SACh. 14 - What does a subclass inherit from its superclass?Ch. 14 - Look at the following pseudocode, which is the...Ch. 14 - Prob. 1AWCh. 14 - Look at this partial class definition, and then...Ch. 14 - Look at the following description of a problem...Ch. 14 - In pseudocode, write the first line of the...Ch. 14 - Look at the following pseudocode class...Ch. 14 - Pet Class Design a class named Pet, which should...Ch. 14 - Car Class Design a class named Car that has the...Ch. 14 - Personal Information Class Design a class that...Ch. 14 - Emp1oyee and ProductionWorker Classes Design an...Ch. 14 - Essay Class Design an Essay class that extends the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What is denormalization?
Database Concepts (7th Edition)
Explain why the rapid delivery and deployment of new systems is often more important to businesses than the det...
Software Engineering (10th Edition)
Sum of Digits in a String Write a program that asks the user to enter a series of single-digit numbers with not...
Starting Out with Python (4th Edition)
Identity the body of the following loop structure and count the number of times it will be executed. What happe...
Computer Science: An Overview (12th Edition)
Given the following declaration and output statement, assume that this has been embedded in a correct program a...
Problem Solving with C++ (10th Edition)
Under what circumstances does an object become a candidate for garbage collection?
Starting Out with Java: Early Objects (6th 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
- In this activity, we are going to plan out and write a class definition that stores information for a book. Let's say we want to store the following information about this book: The book's name The book's author(s) (a book can have more than one author) The book's publisher The book's ISBN number The book's price The book's year of publication First, answer the following questions before the design: 1. What is a suitable name for this class? (Pick a name that best describes it).arrow_forwardDesign and implement an object-oriented program for displaying a deck of cards. Each card will have a value ranging in order from 1 for an ace, 2 for a two, and so on up to and including 11 for a jack, 12 for a queen, and 13 for the king. The focus of the exercise is to create three classes that represent a card, deck, and hand using composition.arrow_forwardYour assignment for this course is to implement a beginner level Book Management System (BMS) in Java language. BMS contains 2 classes: Bookand BookList. The Book class has the following attributes: code: a String object, that hold the book’s code. title: a String object, that hold the book’s title. qua: int variable, that hold the number of books with the same code in the library. price: a double variable, that hold the book’s price. The BookList class contains only one data member: ArrayList<Book> t. When running the program display the menu as below:1. Input & add book(s) to the end.2. Display all books.3. Search a book for given code.4. Update the book’s price for given code.5. Find the (first) max price value.6. Sort the list ascendingly by code.7. Remove the book having given code.8. Load data from file.0. Exit.Notes:(1) The book’s code must be unique in the list.(2) Display all books in format (code, title, quantity, price).(5)…arrow_forward
- Now we are going to use the design pattern for collecting objects. We are going to create two classes, a class AmazonOrder that models Amazon orders and a class Item that models items in Amazon orders. An item has a name and a price, and the name is unique. The Item class has a constructor that takes name and price, in that order. The class also has getters and setters for the instance variables. This is the design pattern for managing properties of objects. The setName() method should do nothing if the parameter is the empty string, and the setPrice() method should do nothing if the parameter is not positive. The class also has a toString() method that returns a string representation for the item in the format “Item[Name:iPad,Price:399.99]”. For simplicity, we assume an Amazon order can have at most 5 items, and class AmazonOrder has two instance variables, an array of Item with a length of 5 and an integer numOfItems to keep track of the number of items in the…arrow_forwardWrite the Movie class. The UML diagram of the class is represented below: 1. Implement the class strictly according to its UML one-to-one (do not include anythingextra, and do not miss any data fields or methods). 2. Implement a MovieTest class to test the class Movie you just created.• Create two Movie objects: one using the no-args constructor and one from theconstructor with all fields.• Print the contents of both objects. Please submit a screenshot. Hint: toString()method.arrow_forwardWrite a class named Person with data attributes for a person’s name, address, and telephone number. Next, write a class named Customer that is a subclass of the Person class. The Customer class should have a data attribute for a customer number and a Boolean data attribute indicating whether the customer wishes to be on a mailing list. Demonstratean instance of the Customer class in a simple program.arrow_forward
- please do task 2 only. TASK 1 Draw the UML class diagrams for the following classes: An abstract Java class called Person that has the following attributes: a String called idNumber a Date called dateOfBirth representing the date of birth. a String for name A class called RideRecord with the following attributes: a Driver attribute an enum called type of RideType a Date called date a double called fee A class called Passenger that extends the Person class and has the following attributes and behaviours: an ArrayList that contains RideRecord objects called rideHistory a public method called takeRide that takes a RideRecord with the following signature:public void takeRide(RideRecord rideRecord); a public boolean method called hasRideHistory that returns whether or not the Passenger has taken a ride before. A Driver class that extends the Person class and has the following attributes and behaviors: a String called licenseCode a public method called giveRide that takes as a…arrow_forwardA company plans to create a system for managing of a movie store. The movie store has a name, address and phone number. Movies are described with title , genre, year of creation, number of sold copies and list of songs. The songs are described with name and duration. Design a set of classes and relationship between each other, which models the data of the record company. Implement a test class, which demonstrates the work of rest of the classesarrow_forwardObject-oriented languages like Java are designed to make it easy for programmers to implement software versions of real-world objects. In learning Java, an important skill to master is the ability to represent an object in code. Objects that we model are described using Java classes, so we have chosen to begin this lab by modeling a very simple, everyday object: a door.Write the code to create a class that models a door object. Don’t worry about the internal details just yet. Just give the class a name and an empty body for the moment. We will add more to the class shortly. When modeling an object as a class, we also need to describe the properties it possesses. An everyday object that we wish to model always has one or more properties that describe it. For instance a door object might have a name like “Front” or “Side” to distinguish it from other doors. Another property that could describe a door is its state: “open” or “closed”. Properties of objects are described in code by using…arrow_forward
- NOTE: READ CAREFULLY Design a class named Person and a subclasses named Employee. Make Teacher a subclass of Employee. A Person has a name, address, and e-mail address. An Employee has an office, salary. A Teacher has office hours and a subject they teach. They also have a tenure status. Define the tenure status as a constant. The tenure status is either Senior or Junior, and is represented as an integer, where Senior is equal to 1, and Junior is equal to 2. Each class should have a Default constructor, and a constructor that accepts all arguments. There should be appropriate calls to the superclass within the constructors. Each class should also have getters and setters for each member variable. Each class should have a toString method. Note: You do NOT need to run this in a test program. Just create the classes as indicated above.arrow_forwardWrite a code for the tracking problem: Consider a tracking program that will track four types of things: Books, Mobiles, Laptop, and Bags. • Implement the Tracking program. • Allow the user to add, modify, and delete Books, Mobiles, Laptop, and Bags. • Allow the user to search for an asset by its serial number. Note: What classes are you going to design for the program? Want to define four non-related classes or one superclass and 4 subclasses? Would it be an abstract superclass if you design a superclass?arrow_forwardClasses – Write a class to represent a AlternativeEnergyCar. Select the fields and methods that fit the modeling of an alternative energy car. Make sure to include code for the constructors, set/get methods, a toString() method.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