Question: The algorithm and psuedocode is something that Ive been working on in class. I need to add the following information to my algorithm and psuedocode.
The algorithm and psuedocode is something that Ive been working on in class. I need to add the following information to my algorithm and psuedocode. If something is incorrect please fill free to correct it.
For completion of the program, use arrays and files.
Instead of prompting the user for the prices of the book, update the website program to reflect the following changes:
Read the prices into an array from a file using a loop
Use a second loop to sum the values stored in the array after the prices of all the books have been read
Write the content of the array to a second file
Create a 1/2- to 1-page document containing pseudocode based on the revised program needs. Replace the pseudocode statements in the existing pseudocode program.
Create a 1- to 2-page flowchart based on the algorithm for the revised program needs. Replace the flowchart structure in the existing flowchart for the program.
Algorithm
1.. Prompt for Number of courses to be taken
2. Prompt for price
3. Prompt Delivery or Pickup
4. Calculate Total Quantity of courses
5. Calculate Cost of each book
6. Calculate shipping
7. Calculate TOTAL COST
8.Display total quantity of courses
9. Display total cost for books
10. Display total cost for shipping
11. Display all total costs
12. Display Credit Card Account Number
Pseudocode
//Declare the Variables
Declare Real bookPrice
Declare Real totalCost
Declare Real totalCourses
Declare Real ShippingCost
Declare Real creditCardAccountNumber
//Prompt for price of book
For (totalCourses = 1 ; totalCourses<5 ; totalCourses++){
Display What is the price of the book?
Input bookPrice
}
//Prompt for totalCourses
Display Enter number of courses
Input totalCourses
//Prompt delivery or pickup
Display Do you want to have your order shipped
Display or will you be picking your order up?
Input delivery or pickup
If (shippingCost >0) {
Then Display ShippingDate and totalCost = shippingCost + bookPrice*totalCourses
}
Else {
totalCost = bookPrice*totalCourses
}
Display Your total cost is: $, totalCost
Display Your books can be picked up at the bookstore.
Input creditCardAccountNumber
Set found = False
Set index = 0
While found == False AND index<=SIZE-1
If (array[index] == searchValue Then
Set found = True
Else
Set index = index +1
End If
End While
If creditCardAccountNumber<=0
Then Display The number is invalid
If creditCardAccountNumber>=0
Display The credit card number is valid
End If
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
