Java All classes must be named as shown in the above UML diagram except the concrete child classes. The ItemList is a singly-linked list with the following methods: • insert(index: int, item: Item) : boolean o Inserts the given item at the given index if an equal item is not already in the list. If the method is successful it returns true. If an equal item already exists in the list or the index is out of range, this method returns false. • add(item: Item): boolean o Adds the given item to the front of the list. Returns true if successful and false if an equal item is already in the list. • set(index: int, item: Item) : Item o Replaces the object in the list at the given index with this object. If the index is out of range or the given item is already in the list, the method returns null. If the operation is successful, the method returns the object that was replaced by this one. • delete(index: int) : Item o Deletes the object at the given index from the list. If the index is out of range, the method returns null. If the operation is successful, the method returns the object that was deleted. • remove(item: Item) : boolean o Removes the given item from the list. If the object does not exist in the list, the method returns false. If the operation is successful, the method returns true. • report(index: int) : Item o Reports the object in the list at the given index. If the index is out of range, returns null. • find(item: Item) : int o Finds the given item in the list and returns the index where it was found. Returns -1 if it is not found. • size() : int o Reports the number of elements currently stored in the list. • toString() : String o Reports a String representation of the list of objects currently stored in it, in the format [first item String, second item String, …, last item String] where each item is displayed using their toString method. • getTotalCost(): double o Reports the total of all the cost field values of all the items in the list. • getTotalValue(): double o Reports the total of the retail prices of all the items in the list, as reported by each item's calcPrice method. Include any added expense as reported by the calcAddedExpense() method if the item is an instance of the SpecialtyItem class.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
Java All classes must be named as shown in the above UML diagram except the concrete child classes. The ItemList is a singly-linked list with the following methods: • insert(index: int, item: Item) : boolean o Inserts the given item at the given index if an equal item is not already in the list. If the method is successful it returns true. If an equal item already exists in the list or the index is out of range, this method returns false. • add(item: Item): boolean o Adds the given item to the front of the list. Returns true if successful and false if an equal item is already in the list. • set(index: int, item: Item) : Item o Replaces the object in the list at the given index with this object. If the index is out of range or the given item is already in the list, the method returns null. If the operation is successful, the method returns the object that was replaced by this one. • delete(index: int) : Item o Deletes the object at the given index from the list. If the index is out of range, the method returns null. If the operation is successful, the method returns the object that was deleted. • remove(item: Item) : boolean o Removes the given item from the list. If the object does not exist in the list, the method returns false. If the operation is successful, the method returns true. • report(index: int) : Item o Reports the object in the list at the given index. If the index is out of range, returns null. • find(item: Item) : int o Finds the given item in the list and returns the index where it was found. Returns -1 if it is not found. • size() : int o Reports the number of elements currently stored in the list. • toString() : String o Reports a String representation of the list of objects currently stored in it, in the format [first item String, second item String, …, last item String] where each item is displayed using their toString method. • getTotalCost(): double o Reports the total of all the cost field values of all the items in the list. • getTotalValue(): double o Reports the total of the retail prices of all the items in the list, as reported by each item's calcPrice method. Include any added expense as reported by the calcAddedExpense() method if the item is an instance of the SpecialtyItem class.
Your job is to write the classes necessary to build the
following backend library:
Node
- value: Item
next: Node
+ Node(value: Item)
+ getValue(): Item
+ setValue(value: Item): void
+ getNext(): Node
+ setNext(next: Node): void
+ID_NUM: long
- model: String
- cost: double
+ Item(idNum: long, model: String, cost: double)
+ getModel(): String
+ setModel(cost: double): void
+ getCost(): double
+ setCost(cost: double): void
+ calcPrice(): double
+ equals(other: Object): boolean
+ hashCode(): int
+ toString(): String
Concrete Child Class
- first: Node
- count: int
add needed fields/constructors/methods
+ ItemList()
+insert(index: int, item: Item): boolean
+ add(item: Item): boolean
+ set(index: int, item: Item): Item
ItemList
+ delete(index: int): Item
+ remove(item: Item): boolean
+ report(index: int): Item
+ find(item: Item): int
Item
+ size(): int
+ toString(): Str
+ getTotalCost(): double
+ getTotalValue(): double
Specialtyltem
+ Specialtyltem(idNum: long, model: String, cost: double)
+ calcAddedExpense(): double
Concrete Child Class
add needed fields/constructors/methods
Transcribed Image Text:Your job is to write the classes necessary to build the following backend library: Node - value: Item next: Node + Node(value: Item) + getValue(): Item + setValue(value: Item): void + getNext(): Node + setNext(next: Node): void +ID_NUM: long - model: String - cost: double + Item(idNum: long, model: String, cost: double) + getModel(): String + setModel(cost: double): void + getCost(): double + setCost(cost: double): void + calcPrice(): double + equals(other: Object): boolean + hashCode(): int + toString(): String Concrete Child Class - first: Node - count: int add needed fields/constructors/methods + ItemList() +insert(index: int, item: Item): boolean + add(item: Item): boolean + set(index: int, item: Item): Item ItemList + delete(index: int): Item + remove(item: Item): boolean + report(index: int): Item + find(item: Item): int Item + size(): int + toString(): Str + getTotalCost(): double + getTotalValue(): double Specialtyltem + Specialtyltem(idNum: long, model: String, cost: double) + calcAddedExpense(): double Concrete Child Class add needed fields/constructors/methods
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Types of Linked List
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education