Using selection and iteration 2

Using selection and iteration 2

Type of document           Editing

2 Pages Double Spaced

Subject area         Computer Science

Academic Level Undergraduate

Style      APA

References         1

Order description:

The university would like to remind students to pick-up their books at the bookstore if they choose not to have books delivered.
Revise the website program to reflect the following changes:
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
Create a 1/2- to 1-page document containing pseudocode based on the revised program needs.
Create a 1-page flowchart based on the algorithm for the revised program needs.

 

Using Selection and Iteration II: Pseudocode

  • // Give a welcome for the University book store
  • Display “Welcome to the University Bookstore”
  • // Declare variables for program
  • Declare Real Price of book
  • Declare Real Shipping
  • Declare Real Total books
  • Declare Real Total order
  • Declare Integer Number of courses taken
  • Declare Integer Credit Card Account Number [SIZE]
  • Declare Integer index
  • Declare Integer Course counter
  • Declare Boolean found
  • Constant flatrate = $5.00
  • Constant Integer Size = 1
  • // Get the Number of Courses Taken
  • Display “Enter the Number of Courses Taken”
  • Input the Number of Courses taken
  • // Initialize accumulators for course counter
  • Set course counter = 1
  • // Get the price of books for the courses taken
  • For Course Counter = 1 to Number of courses taken
  • Display “Enter the price of book”
  • Input price of book
  • Display “The price of book the book entered”
  • Set Total books = Total books + Input price of book
  • Set Course Counter = course counter + 1
  • End For
  • // Determine shipping options
  • Display “Enter Shipping Options: (Ship/Pickup)”
  • Input Shipping Option
  • If Shipping option == (Ship) then
  • Display “Books are shipped together at a flatrate of $5.00 per book”
  • Set Total shipping = Course counter * flatrate
  • Display “Enter shipping address”
  • Input shipping address
  • Display “Shipping address”
  • Else
  • Display “Books will be held for store pickup at your earliest connivance”
  • Display “There are no shipping charges”
  • End if
  • // Get users credit card account number from user
  • For index = 0 To SIZE -1
  • Display “Enter the Credit Card number you wish to use”, index + 1
  • Input Credit Card number [index]
  • End For
  • // Step through the array searching for the credit card number entered by the user
  • Set found = False
  • Set index = 0
  • While found == False AND index <= size – 1
  • If Credit Card number [index] == Card number entered, Then
  • Set found = True
  • Else
  • Set index = index + 1
  • End if
  • End while
  • // Display the results of the credit card number search
  •  If found
  • Display “The Credit Card number enter is valid”
  • Else
  • Display “The Credit Card number entered is invalid please enter a valid Credit Card number”
  • End if
  • // Determine total charges
  • Set Total order = Total books + Total shipping
  • //Display the order data
  • Display “Here is your order”
  • Display “Total books $”, Total books
  • Display “Total shipping $”, Total shipping
  • Display “Total order $”, Total order
  • End