Question
NEED HELP WITH JAVA PROJECT INSERT 3 BOOKS TO THE STRUCTURE (GenericStack OR GenericQueue) Display the message to ask and read the information of a
NEED HELP WITH JAVA PROJECT
INSERT 3 BOOKS TO THE STRUCTURE (GenericStack OR GenericQueue)
Display the message to ask and read the information of a Book from the keyboard. Create the object of Book then insert to the data structure. After finishing, display all the book in the following format:
SP2021_StackQueueDemo_Martinez.java
INSERT 3 BOOKS LUIS MARTINEZ
-------------------------------------------
stack: [
ISBN: 978-1-337-10208-7
Book Title: C++ Programming From Problem Analysis to Program Design
Writer D.S Malik
Publisher: Cengage
,
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
,
ISBN: 978-0-136-52015-3
Book Title: Introduction to Java Programming and Data Structures
Writer Daniel Liang
Publisher: Pearson
]
OR
SP2021_StackQueueDemo_Martinez.java
INSERT 3 BOOKS LUIS MARTINEZ
-------------------------------------------
Queue:
[
ISBN: 978-1-337-10208-7
Book Title: C++ Programming From Problem Analysis to Program Design
Writer D.S Malik
Publisher: Cengage
,
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
,
ISBN: 978-0-136-52015-3
Book Title: Introduction to Java Programming and Data Structures
Writer Daniel Liang
Publisher: Pearson
]
DELETE ONE BOOK
Remove the book then display the removed book in the following format:
If the stack or queue is empty, display the following:
SP2021_StackQueueDemo_Martinez.java
DELETE ONE BOOK LUIS MARTINEZ
-------------------------------------------
The stack is empty
OR
SP2021_StackQueueDemo_Martinez.java
DELETE ONE BOOK LUIS MARTINEZ
-------------------------------------------
The queue is empty
If the stack or queue is NOT empty, display the book:
SP2021_StackQueueDemo_Martinez.java
DELETE ONE BOOK LUIS MARTINEZ
-------------------------------------------
ISBN: 978-0-136-52015-3
Book Title: Introduction to Java Programming and Data Structures
Writer Daniel Liang
Publisher: Pearson
OR
SP2021_StackQueueDemo_Martinez.java
DELETE ONE BOOK LUIS MARTINEZ
-------------------------------------------
ISBN: 978-1-337-10208-7
Book Title: C++ Programming From Problem Analysis to Program Design
Writer D.S Malik
Publisher: Cengage
DISPLAY THE BOOK AT THE TOP (Stack) / AT THE FRONT (Queue)
If the stack or queue is empty, display the following:
SP2021_StackQueueDemo_Martinez.java
BOOK AT TOP LUIS MARTINEZ
-------------------------------------------
The stack is empty
OR
SP2021_StackQueueDemo_Martinez.java
BOOK IN FRONT LUIS MARTINEZ
-------------------------------------------
The queue is empty
If the stack or queue is NOT empty, display the book:
SP2021_StackQueueDemo_Martinez.java
BOOK AT TOP LUIS MARTINEZ
-------------------------------------------
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
OR
SP2021_StackQueueDemo_Martinez.java
BOOK IN FRONT LUIS MARTINEZ
-------------------------------------------
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
SHOW ALL BOOKS
Display all the BOOKS currently stored in the data structure:
If the stack or queue is empty, display the following:
SP2021_StackQueueDemo_Martinez.java
SHOW ALL BOOKS LUIS MARTINEZ
-------------------------------------------
The stack is empty
OR
SP2021_StackQueueDemo_Martinez.java
SHOW ALL BOOKS LUIS MARTINEZ
-------------------------------------------
The queue is empty
If the stack or queue is NOT empty, display the book:
SP2021_StackQueueDemo_Martinez.java
SHOW ALL BOOKS LUIS MARTINEZ
-------------------------------------------
stack: [
ISBN: 978-1-337-10208-7
Book Title: C++ Programming From Problem Analysis to Program Design
Writer D.S Malik
Publisher: Cengage
,
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
]
OR
SP2021_StackQueueDemo_Martinez.java
SHOW ALL BOOKS LUIS MARTINEZ
-------------------------------------------
Queue:
[
ISBN: 978-1-111-82595-9
Book Title: Just Enough Programming Logic and Design
Writer Joyce
Publisher: Cengage
,
ISBN: 978-0-136-52015-3
Book Title: Introduction to Java Programming and Data Structures
Writer Daniel Liang
Publisher: Pearson
]
BOOK CLASS:
package OBJECT; public class Book { //data members private String ISBN; private String title; private String writer; private String publisher; //constructor public Book() { ISBN = ""; title = ""; writer = ""; publisher = ""; } //constructor public Book(String isbn, String t, String w, String p) { ISBN = isbn; title = t; writer = w; publisher = p; } public String toString() { return String.format(" %-12s%-30s ", "ISBN:", ISBN) + String.format("%-12s%-30s ", "Book Title:", title) + String.format("%-12s%-30s ", "Writer:", writer) + String.format("%-12s%-30s ", "Publisher:", publisher); } }
This lab we will work with Data structure type GenericStack and GenericQueue Provide an application to implement Stack and Queue that we learned from Chapter 24. You must create at least 3 user- defined functions beside the function main!). First, the application show Menu to allow users to select the type of data structure to work on. After finishing with one data structure type, redisplay the menu to allow users to select other until users select EXIT to terminate the program SP2021_3tactQueue Demo_Martinez.java MENU SELECT DATA STRUCTURE - LUIS MARTINEZ 1. Generic Stack 2. Generic Queue 0. Exit For each selected data structure type, display the sub-menu of operations: SP2021_3tactQueue Demo_Martinez.java SUB MENU SELECT OPERATION - LUIS MARTINEZ 1.Insert 3 Books 2.Delete one book 3.Display Book at TOP (Stack) or in FRONT (Queue) 4.Display all Books 0.Exit INSERT 3 BOOKS TO THE STRUCTURE (GenericStack OR GenericQueue) Display the message to ask and read the information of a Book from the keyboard. Create the object of Book then insert to the data structure. After finishing display all the book in the following format 392021_3tackQueue Demo_Martines.java INSERT 3 BOOKS - LUIS MARTINEZ stack: [ ISBN: Book Title: 978-1-337-10208-7 C++ Programming - From Problem Analysis to Program Design This lab we will work with Data structure type GenericStack and GenericQueue Provide an application to implement Stack and Queue that we learned from Chapter 24. You must create at least 3 user- defined functions beside the function main!). First, the application show Menu to allow users to select the type of data structure to work on. After finishing with one data structure type, redisplay the menu to allow users to select other until users select EXIT to terminate the program SP2021_3tactQueue Demo_Martinez.java MENU SELECT DATA STRUCTURE - LUIS MARTINEZ 1. Generic Stack 2. Generic Queue 0. Exit For each selected data structure type, display the sub-menu of operations: SP2021_3tactQueue Demo_Martinez.java SUB MENU SELECT OPERATION - LUIS MARTINEZ 1.Insert 3 Books 2.Delete one book 3.Display Book at TOP (Stack) or in FRONT (Queue) 4.Display all Books 0.Exit INSERT 3 BOOKS TO THE STRUCTURE (GenericStack OR GenericQueue) Display the message to ask and read the information of a Book from the keyboard. Create the object of Book then insert to the data structure. After finishing display all the book in the following format 392021_3tackQueue Demo_Martines.java INSERT 3 BOOKS - LUIS MARTINEZ stack: [ ISBN: Book Title: 978-1-337-10208-7 C++ Programming - From Problem Analysis to Program Design
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started