Bookstore Application: A Comprehensive Java Programming Project

Verified

Added on  2021/04/17

|38
|4445
|25
Project
AI Summary
This document details a console-based bookstore application developed in Java. The application allows users to manage a collection of books, including adding, searching, updating, and deleting book entries. Each book entry comprises an ISBN, title, author, publisher, publishing year, price, and stock quantity. The application features functionalities such as adding new books, searching by ISBN, title, and author, updating stock and price, calculating total stock amount and price, identifying the most expensive book, sorting the collection by author name, and removing books. The program utilizes a menu-driven interface for user interaction and includes a UML class diagram and algorithm outlining the program's structure and flow. The provided output run demonstrates the application's functionality, including adding books, searching, updating stock, and interacting with the menu options.
Document Page
Running head: BOOKSTORE APPLICATION
BookStore Application
Name of the Student:
Name of the University:
Author note:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1
BOOKSTORE APPLICATION
The Bookstore Application Summary
The application has been built using the JAVA language. The console-based
application is meant to serve the purpose of maintaining a bookstore. The user can switch into
the system as an administrator and add, view, update or delete books from the collection
generated.
The program generates an initial array of books and allows the user to add to it. Each
book has a unique ISBN, title, author, publishing year and name, price and the numbers in
stock. The User can also chose to update the price for the book or the stock count of it.
Features of the bookstore application include, adding a new book, searching books by ISBN,
Title and Author name, updating stock and price, calculating total stock amount, calculating
total stock price, finding out the most expensive book, sorting the collection with respect to
author names, deleting a book from the collection and so on.
Document Page
2
BOOKSTORE APPLICATION
UML Class Diagram
Document Page
3
BOOKSTORE APPLICATION
Algorithm
Start
Client class: Main ( )
Step 1: Display menu
Step 2: Input choice
Step 3: If (wrong choice) display ERROR message and goto step 1, else goto next step
Step 4: Call respective functions of the BookStore class, according to user’s choice
BookStore class:
add ( )
Step 1: Input book details.
Step 2: Create Book type object and add to array.
Step 3: Increase array index by 1.
searchBook ( )
Step 1: Input ISBN string
Step 1: Call function searchISBN from Book class
Step 2: If return value is -1 display ISBN missing else return search index.
searchAuthor ( )
Step 1: Input author string
Step 2: Call function searchAuthor from Book class
Step 3: If return value is 0 display Author missing.
searchBook ( )
Step 1: Input title string
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4
BOOKSTORE APPLICATION
Step 2: Call function searchTitle from Book class
Step 3: If return value is -1 display book missing else return search index.
updateStock ( )
Step 1: Input ISBN string
Step 2: Call function searchBook from Book class
Step 3: Input new stock value
Step 4: Call updateStock method from Book class for the book object at the returned
index in array.
updatePrice ( )
Step 1: Input ISBN string
Step 2: Call function searchBook from Book class
Step 3: Input new stock value
Step 4: Call updateStock method from Book class for the book object at the returned
index in array.
mostExp ( )
Step 1: Check if totalBook is 0
Step 2: If yes return back, else next step
Step 3: Set variable max to 0
Step 4: For each object in array, get price
Step 5: Check if price is > max, and update max and index to that price and index
respectively.
Step 6: Display book details
totalStock ( )
Document Page
5
BOOKSTORE APPLICATION
Step 1: Check if totalBook is 0
Step 2: If yes return back, else next step
Step 3: Set totalStock to 0
Step 4: For each object in array, get stock value and add to totalStock
Step 5: Return totalStock
netPrice ( )
Step 1: Check if totalBook is 0
Step 2: If yes return back, else next step
Step 3: Set price to 0
Step 4: For each object in array, get stock value and add to price
Step 5: Return price
displayAll ( )
Step 1: Check if totalBook is 0
Step 2: If yes return back, else next step
Step 3: For each object in array, call the display method from Book class
remove ( )
Step 1: Call searchBook method
Step 2: If index is returned successfully, goto next step.
Step 3: For i = index and less than totalBooks-1, set Collection array value with its
next value, and increment i
Step 4: Decrease totalBooks value by 1
sort ( )
Step 1: Check if totalBook is 0
Document Page
6
BOOKSTORE APPLICATION
Step 2: If yes return back, else next step
Step 3: Sort using reverse bubble sort
Step 4: Call displayAll method
End
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7
BOOKSTORE APPLICATION
Output
run:
Name: Seah Leng Ho
Student Number: 33058916
Mode of Enrolment: External, Part time
Welcome to My Book Store
------------------------
Main Menu
=========
Enter 1: Create the book collection.
Enter 2: Add a new book to the collection.
Enter 3: Search book using ISBN.
Enter 4: Search books by author name.
Enter 5: Update stock by searching via ISBN.
Enter 6: Update book price by searching via title.
Enter 7: Find the most expensive book.
Enter 8: Display the total stock of books.
Document Page
8
BOOKSTORE APPLICATION
Enter 9: Calculate and Display the total monetary pricing of all books in stock.
Enter 10: Display all books in stock.
Enter 11: Removes a book from the collection.
Enter 12: Sort and display the Book Collection according to author names.
Enter 0: Exit the system.
Enter now... 1
Enter details for book #1...
Enter the title of the book:
War and Peace
Enter the author name:
Leo Tolstoy
Enter the publisher name:
ABC
Enter the publishing year:
1928
Enter the ISBN:
123456
Enter the price:
Document Page
9
BOOKSTORE APPLICATION
$5.5
Enter the number of books in stock:
20
New book added!
Enter details for book #2...
Enter the title of the book:
Wizard of Oz
Enter the author name:
Frank Baum
Enter the publisher name:
XYZ
Enter the publishing year:
2009
Enter the ISBN:
987665
Enter the price:
$-9
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10
BOOKSTORE APPLICATION
Price cannot 0 or less! Enter again...Enter the price:
$9
Enter the number of books in stock:
0
Initial stock cannot 0 or less! Enter again...Enter the number of books in stock:
10
New book added!
Enter details for book #3...
Enter the title of the book:
Jungle Book
Enter the author name:
Rudyard Kipling
Enter the publisher name:
QWE
Enter the publishing year:
2010
Enter the ISBN:
Document Page
11
BOOKSTORE APPLICATION
159357
Enter the price:
$15.5
Enter the number of books in stock:
12
New book added!
Main Menu
=========
Enter 1: Create the book collection.
Enter 2: Add a new book to the collection.
Enter 3: Search book using ISBN.
Enter 4: Search books by author name.
Enter 5: Update stock by searching via ISBN.
Enter 6: Update book price by searching via title.
Enter 7: Find the most expensive book.
Enter 8: Display the total stock of books.
Enter 9: Calculate and Display the total monetary pricing of all books in stock.
Enter 10: Display all books in stock.
chevron_up_icon
1 out of 38
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]