You are to implement a book purchasing system, called TechBooks. The system keeps a list of book titles that can be purchased, in both physical and ebook form.
Implement the above specifications, without worrying about availability of physical books or whether there is an ebook. This means the only information you have to store about a book is the title. You do not have to use object oriented concepts at this point: you can implement the system in a main program as a single class. However, you should use multiple methods to break up the complexity of your code: i.e., dont put it all in one method!
The system should present a menu with the following options:
UPDATE: Option 1 only needs to display the FIRST matching title found and automatically adds it (a physical copy) to the Shopping Cart. If there are no matches then an error is printed.
The aim of Part B is to incorporate basic object oriented concepts into your program. In particular, define a Book class that contains all information related to a book: title, author, number of physical copies, and ebook availability. Your main program should be in a new Store class. Using the OO solution, your store could contain an array of Book objects.
Updates to the functionality:
NOTE: it is OK to start using Object Oriented concepts from the start of the assignment if you prefer---i.e. it is not a requirement to complete Part A before introducing OO.
Book titles to include as data:
You must include the following titles as a minimum exactly as written below, for testing purposes (use only titles for testing Part A). Number of items in stock and ebook availability are indicated. For this assignment, you may hand-code these books directly into your Store:
Absolute Java (Savitch) 5 yes
JAVA: How to Program (Deitel and Deitel) 0 yes
Computing Concepts with JAVA 3 Essentials (Horstman) 5 no
Java Software Solutions (Lewis and Loftus) 5 no
Java Program Design (Cohoon and Davidson) 1 yes
Below is a sample interaction with the TechBooks system. You do not have to follow this precisely but it illustrates the required functionality. Text in bold is input from the user:
Welcome to TechBooks!
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit
Please make a selection: 1
Enter title to search for: Java concepts
There is no title starting with that
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit
Please make a selection: 1
Enter title to search for: Java
The following title is a match:
1. JAVA: How to program
0. cancel What is your selection: 1
Do you want to buy this as an ebook: no
There are no physical copies of that book available!
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 1
Enter title to search for: Computing
The following title is a match:
1. Computing Concepts with JAVA 3 Essentials
0. cancel What is your selection: 1
Do you want to buy this as an ebook: no
“Computing Concepts with JAVA 3 Essentials” has been added to your Cart
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 2
Your Shopping Cart contains the following items:
1. Computing Concepts with JAVA 3 Essentials
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 1
Enter title to search for: Absolute
The following title is a match:
1. Absolute Java
0. cancel What is your selection: 1
Do you want to buy this as an ebook: no
“Absolute Java” has been added to your Cart
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 2
Your Shopping Cart contains the following items:
1. Absolute Java
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit
Please make a selection: 3
You purchased the following item(s):
1. Absolute Java
You have purchased items to the total value of $30.00 Thanks for shopping with TechBooks!
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit
Please make a selection: 4
The following titles are available:
1. Absolute Java (Savitch), 4 copies, no ebook
2. JAVA: How to Program (Deitel and Deitel), 0 copies, ebook available
3. Computing Concepts with JAVA 3 Essentials (Horstman), 5 copies, no ebook
4. Java Software Solutions (Lewis and Loftus), 5 copies, no ebook
5. Java Program Design (Cohoon and Davidson), 1 copy, ebook available
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 8
Sorry, that is an invalid option!
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 0
Goodbye
Extend your solution so that:
All matches to a search are displayed and the user selects using line number. An error is printed if the user selects an invalid line number, and the system prompts for a new line number. There should also be a cancel option.
The Shopping Cart can hold up to at least 10 items. (There are no marks for it, but if you want to extend yourself, add a Remove Item from Shopping Cart option.)
To implement this extension, you need to use more arrays (for selection and Shopping Cart).
This extension would result in the following changes to the above interaction:
Choose an option:
1. Add a book to shopping cart
2. View shopping cart
3. Checkout
4. List all books
0. Quit Please make a selection: 1
Enter title to search for: Java
The following title is a match:
1. JAVA: How to program -- Deitel and Deitel
2. Java Software Solutions -- Lewis and Loftus
3. Java Program Design -- Cohoon and Davidson
0. cancel
Which number item do you wish to purchase: 1
Purchasing: JAVA: How to program This is not available as an ebook There is no ebook available for that title “JAVA: How to program” has been added to your Cart