Data Structures and Algorithms in Java
6th Edition
ISBN: 9781119278023
Author: Michael T. Goodrich; Roberto Tamassia; Michael H. Goldwasser
Publisher: Wiley Global Education US
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
thumb_up100%
Chapter 2, Problem 16C
Explanation of Solution
Initial considerations:
Normally, the E-book shop contains a variety list of books from which the customers places an order based on their favor.
The following architecture is not the absolute design for “e-book reader” architecture. It is the assumption and it includes variety of classes to follow the inheritance property.
Primary classes and methods:
The primary classes and the methods of E-book reader that the java software required are as follows:
- “E-bookshop”, “Customer”, “Order”, “ItemOrder”, and “Item”.
- E-bookshop contains the methods getDownloadURL() and getsizeMB().
- getDownloadURL() is used to download the site of the book that the customer needs to purchase.
- getsizeMB() is used to know the size of the book in bytes.
- Customer class contains the method Customer()
- This method is to retrieve the details of customer.
- Order class contains the method Order().
- This method places the shipping details of order.
- ItemOrder class contains the method ItemOrder()
- This method used to get the number of order that the customer wants to place before purchasing.
- Item class contains no method but is generalized into three sub classes such as Book, MusicCD, and Software.
- The Book class contains the method Book() which is used to order the specific book based on author name.
- The MusicCD class contains the method MusicCD() which is used to order the CD’s based on the artist collections.
- The Software class contains the method Software() which is used to download the book based on the version.
Inheritance diagram for “E-book reader”:
Inheritance diagram is drawn from parent class to child class...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Use java programming properties to write all the necessary classes and/or interfaces for a solution to the problem. Focus on class structure and interaction. You may implement your solution however you wish, but you will be graded on the appropriateness of your solution to the requirements. Note the use of capitalization and parentheses for clarification. You may use whatever constructors or additional methods you wish.
Define a structure that can represent Animals. Animals have two behaviors; they can speak() and they can move(). By default, when an animal moves, the text ”This animal moves forward” is displayed. By default, when an animal speaks, the text ”This animal speaks” is displayed. A general Animal should not be able to be instantiated. Define two classes, Goose and Lynx, that are Animals. Both Goose and Lynx behave such that where “Animals” is displayed in speak() or move(), “goose” or “lynx” is displayed by the appropriate classes. Finally, any instance of Goose can fly(),…
Your 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)…
Below we have class diagrams with three classes for a simple java based parking management class. Use the classes below to write java code for classes :a parking observer class (that implements an observer pattern) , a transaction manager class and a parking lot class(subject to the observer). Use the class diagram and java class to implement it. You should use an observer pattern to implement your code.The main goal is to implement the following - Once a car enters (in an entry-scan only lot) or leaves (in an entry-scan and exit-scan lot), then the ParkingObserver will be updated, and then can register the charge with the parking system via the TransactionManager’s park() method
Chapter 2 Solutions
Data Structures and Algorithms in Java
Ch. 2 - Give three examples of life-critical software...Ch. 2 - Give an example of a software application in which...Ch. 2 - Prob. 3RCh. 2 - Prob. 4RCh. 2 - Prob. 5RCh. 2 - Give a short fragment of Java code that uses the...Ch. 2 - Prob. 7RCh. 2 - Prob. 8RCh. 2 - Prob. 9RCh. 2 - Prob. 10R
Ch. 2 - Prob. 11RCh. 2 - Draw a class inheritance diagram for the following...Ch. 2 - Prob. 13RCh. 2 - Prob. 14RCh. 2 - If the parameter to the makePayment method of the...Ch. 2 - Prob. 16CCh. 2 - Most modern Java compilers have optimizers that...Ch. 2 - The PredatoryCreditCard class provides a...Ch. 2 - Modify the PredatoryCreditCard class so that a...Ch. 2 - Prob. 20CCh. 2 - Write a program that consists of three classes, A,...Ch. 2 - Prob. 22CCh. 2 - Prob. 23CCh. 2 - Write a Java class that extends the Progression...Ch. 2 - Redesign the Progression class to be abstract and...Ch. 2 - Use a solution to Exercise C-2.25 to create a new...Ch. 2 - Use a solution to Exercise C-2.25 to reimplement...Ch. 2 - Write a set of Java classes that can simulate an...Ch. 2 - Write a Java program that inputs a polynomial in...Ch. 2 - Write a Java program that inputs a document and...Ch. 2 - Prob. 31PCh. 2 - Write a Java program that simulates a system that...Ch. 2 - Define a Polygon interface that has methods area()...Ch. 2 - Prob. 35PCh. 2 - Write a Java program that can make change. Your...
Knowledge Booster
Similar questions
- For this project, you will implement an email client-server simulator using the object-oriented design diagramed below. The class diagram above shows class attributes (members) and methods (operations). Operations are denoted with a plus. The diamonds indicate an aggregation relationship between the connected classes. For example, a mailbox list can have one or many mailboxes. A Mailbox can have one or many messages. You will therefore need data structures container objects (lists) to contain these types of objects, as we have seen in previous exercises. All class attributes are private unless denoted otherwise and therefore must be accessed with constructors. getters, ord setters. Constructors are a preferred way to set class attributes. Constructors, setters, getters, and toString methods can be generated by IntelliJ. Check the IntelliJ documentation for how to use the Generate feature. Messages are simultaneously sent and received. Therefore, a Message is…arrow_forwardCreate a UML class hierarchy (three connected UML diagrams) that has all three classes youcreated above. Make sure each UML diagram is a one-to-one to the code, it matches the Javacode exactly. Make sure that both Child Classes point to their Parent.Hint: your subclasses are siblings.Hint: You need to create three UML diagrams for three created Java classes and connect themusing arrows, where each Child Class points to its Parent. You can either draw this by hand andtake a picture or use a tool / software of your choice. class Desktop extends Computer { private int width; private int height; public Desktop() { super(); width = height = 0; } public Desktop(String manufacturer, String diskSize, String manufacturingDate, int numberOfCores, int width, int height) { super(manufacturer, diskSize, manufacturingDate, numberOfCores); this.width = width; this.height = height; } public int getWidth() { return width; }…arrow_forwardCreate a UML class hierarchy (three connected UML diagrams) that has all three classes youcreated above. Make sure each UML diagram is a one-to-one to the code, it matches the Javacode exactly. Make sure that both Child Classes point to their Parent.Hint: your subclasses are siblings.Hint: You need to create three UML diagrams for three created Java classes and connect themusing arrows, where each Child Class points to its Parent. You can either draw this by hand andtake a picture or use a tool / software of your choice. class Desktop extends Computer { private int width; private int height; public Desktop() { super(); width = height = 0; } public Desktop(String manufacturer, String diskSize, String manufacturingDate, int numberOfCores, int width, int height) { super(manufacturer, diskSize, manufacturingDate, numberOfCores); this.width = width; this.height = height; } public int getWidth() { return width; }…arrow_forward
- TASK Design the Java classes named Shape, Rectangle and Point by taking into account the following UML diagram: Write a Test dass to verify your implementation. Shape -color: String -location : Point +Shape(String) +getX(): double +getY() : double +setLocation(double,double) : void +getColor(): String +setColor(String): void +Print() : void Circle Point +radius: double +setCenter(double,double): void +getCenter () : Point +setColor (String): void +getColor(): String +Print() : void +Circle(double) -x: double -y: double +getX(): double +setX): void +getY() : double +setY() : void +Print() : void Rectangle '+width : double +height : double +getCornerLeftLow() : Point +getCornerleftUpp: Point +getCornerRightLow() : Point +getCornerRightUpp() : Point +setLocation(double, double) : void +setColor(String): void +getColor() : String +getArea() : double +Print() : void +Rectangle(double,double) NOTES: (1) The location of a Rectangle object is defined as its lower left corner and the location…arrow_forwardWhy is it not possible to implement the multiple inheritance in Java? How do you solve that problem? Give at least one example that describes a way to implement the multiple inheritance using an interface.arrow_forwardPlease help me design a SimulationProject.cpp in C++. THANK YOU! For this assignment, we will simulate boarding procedures for Airworthy Airlines. The Airline's current procedure is as follows: pre-board in the following order: families with young children or people who need help (e.g., wheelchair) first class and/or business class passengers elite passengers (frequent fliers) and those passengers seated in exit rows conduct general boarding in reverse, from the back of the plane to the front in the following order: rows 23-26 rows 17-22 rows 11-16 rows 5-10 Airworthy is considering revising their boarding procedure such that general boarding is done randomly, meaning the first passenger in line for general boarding is the first passenger to board (i.e., general boarding passengers all have the same priority). Airworthy suspects this random general boarding method will improve the flow of passengers, getting them on board and seated more quickly. It is also less labor-intensive…arrow_forward
- WRITE JAVA CODE ACCORDING TO THE DEIGN PATTERN BY LOOKING AT THE CLASS DIAGRAM The function of the code is up to you, let it be suitable for the content of the design pattern, as long as you write according to which pattern you are coding and comment lines.arrow_forwardWrite the implementation of the Java classes based on the following UML diagram. (a) Define the method IncreTotSpecies) to increment the data field totalSpecles (b) Define the method printColor) to print the data field color (c) Override the method printColor) in the class Falcon to print the data fields featherColor, beakColor Birds +color: String +foodHabit: String +totalSpecies: int -skeleton: String +Birds () +Birds(color: String, foodHabit: String, skeleton: String) +increTotSpecies (): void +printColor (): void Falcon -featherColor: String -beakColor: String +Falcon (featherColor: String, beakColor: String) +printColor (): voidarrow_forwardRead on if you want to learn more about software design and how different methods work. For each group, there should be at least five lines of description.Trying to find out moreThe building's plan and how easy it is to use the interfacePutting together breakout groupsarrow_forward
- Take a look at the following class diagram, write Java code that simulate the two classes Student Name: String GPA: double +Student(string, double) +toString(): String +UpdateGPA(double) Honors -adivsor:String +Honor(String, string , double) +toString(): string +setAdvisor(String)arrow_forwardUse java languagearrow_forwardUSING JAVA: Enhance the Invoice-printing program by providing for two kinds of line items: One kind describes products that are purchased in a certain numerical quantities ( Such as “3 toasters”), another describes a fixed charge ( Such as “shipping $5.00”). Hint: Use inheritance. Produce a UML diagram of your modified implementation.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