Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please choose the type of the item from below list: Press 1 for Book Press 2 for DVD Press 3 for Magazine 1 Please enter

Please choose the type of the item from below list:
Press 1 for Book
Press 2 for DVD
Press 3 for Magazine
1
Please enter the item:
The Lord of the Rings: The Fellowship of the Ring
Please enter the owner of the item:
James Bond
Press 1 to continue adding item, 0 to exit
1
Please choose the type of the item from below list:
Press 1 for Book
Press 2 for DVD
Press 3 for Magazine
2
Please enter the item:
Harry Potter and the Philosopher's Stone
Please enter the owner of the item:
Brad Pitt
Press 1 to continue adding item, 0 to exit 0
0
Library information listed below:
James Bond has delivered The Lord of the Rings: The Fellowship of the Ring from Book collection.
Brad Pitt has delivered Harry Potter and the Philosopher's Stone from DVD collection.
image text in transcribed
Java language
Write a Java program that simulates a basic library delivery system. The user of the program will be able to add different types of items to library collection. In your program, as the main data structure, use the generic collection class ArrayList to store String references. Create three instances from ArrayList of String references. The first one will store the types, the second one will store the items, and the third one will store the owners of the items. The types are exactly the following: "Book", "DVD", "Magazine". The items and their owners will be read from the keyboard Regarding the matching between an item and its owner, the location (index value) of an item in the list of items will be the same with the location of its corresponding owner in the list of owners. As the next step, create the fourth instance from ArrayList of String references and call this list as items DeliveredByOwners. This last list will store String references to indicate the owners of the items (such as the following: "ownerx has delivered the itemNamey from type2 collection"). After reading any number of items and their owners, the program will finally print the contents of items DeliveredByOwners list. Please, consider the sample output shown below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

How much total revenue did that state generate overall?

Answered: 1 week ago