Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prompt the student for the number of courses being taken Use a for loop to prompt the student for the price of each book based

Prompt the student for the number of courses being taken

Use a for loop to prompt the student for the price of each book based upon the number of classes being taken

After the price of each book has been entered, display the total price of the books

Prompt the user for the following shipping options: delivery or pick-up

Use an if-then-else statement to add the charges to the total price if the shipping charges are greater than 0

If there are shipping charges, display the total charges and shipping date

If there are no shipping charges, display the total charges and a message indicating that the books can be picked up at the bookstore

Use an array to prompt the user to enter a credit card account number

Use the sequential search algorithm to locate the credit card number entered by the user

If the credit card number is not in the array, display a message indicating the number is invalid

If the credit card number is in the array, display a message indicating the credit card number is valid

Create a 1/2- to 1-page document containing pseudocode based on the revised program needs. Add the pseudocode statements to the existing pseudocode program.

Create a 1- to 2-page flowchart based on the algorithm for the revised program needs. Add the flowchart structure in the existing flowchart for the program.

image text in transcribed

#Doc1 psuedocode

Display books with name, type of course and price as major points.

Each course will have multiple books but the user can buy only one.

User will select books, one from each course and can have max 5 books.

When the user checkouts from his order, the total price of the books will be calculated.

User can view cost of each book during checkout and finally decide to buy or not.

Expected output :

User browses through the books (In future you can also add book categories)

User is able to add 1 book per course and checkouts 5 books.

User views the total cost and pays.

#Doc 2 (Algorithm)

User views books with book-name, course type and its cost. Create a class Book with the above attributes and create getters and setters.

User clicks on the add book button and adds it to his cart

Use a HashSet / set of books to store unique books. eg. set bookSet. This set ensures that the same book cannot be added twice by the user.

When a user adds a book with the same name, iterate through the set and check if any book exists with the same course name. If it does not contain, add it

if( ! bookSet.contains(currentBookToBeAddedObject.getBookName()) {.....add the book to the set ...}

If the bookSet already contains a book with the same course type, remove the existing book and add the new book with same course type e.g. erase the exisitng object from the set using

if(bookSet.contains(currentBookToBeAddedObject.getBookName()){ bookSet.erase(exisitngObj); bookSet.insert(newObj);}

After checkout, iterate through the set of book and calculate the total cost. e.g. for(Book book : bookSet) { totalCost += book.getCost(); }

Display the required output.

USER Ns tL. Coast Add to USER Ns tL. Coast Add to

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

Define opportunity cost.

Answered: 1 week ago