The university updated its website program design request with a few more features to fit its needs.Update the website program to reflect the following changes:Use an array to prompt the user to enter
Memo
To: | |
From: | |
Class: | PRG211 |
Date: | |
Re: | Individual Assignment for Week 4 |
Initially the University required a website design that would prompt students to order at least five books. In addition, the students would then input the prices of the books and the program would return the total price of the books. However, the university has reassessed its needs and realized it is not necessary for students to take five classes. Therefore, the following program requires the student to input the number of courses they are taking and the program calculates the total price. Further, the website has been designed to facilitate delivery method where students have two options either to physically pick the documents or have the books shipped. Therefore, to solve the University’s problem, an algorithm is designed to define the steps that will be followed by the design.
Pseudo code for the program
Begin Program
Declare string shippingOption
Declare float totalPrice
Declare float bookPrice
Declare Integer numberOfCourses
Declare float shippingCharges
Declare Object shippingDate
Display “Enter number of courses being taken”
Input numberOfCourses
FOR courses counter is less than or equal to numberOfCourses
Display “Enter the price of each book?”
Input bookPrice
Set totalPrice = totalPrice + bookPrice[courses]
Display totalPrice
END FOR
Display “Enter Shipping Options (Either Delivery or Pick up)”
Input shippingOption
IF shippingOptions is equal to “delivery” and shippingCharges greater than 0
Set totalPrice = totalPrice + shippingCharges
Display totalPrice “ and “ shippingDate
ELSE IF shippingOptions is equal to “pickup” and shippingCharges equal 0
Display totalPrice
Display “Books can be picked up at the store
ELSE
Display “No such shipping option; enter either delivery or pickup”
End program
//by the end of the for loop, we have calculated the total price of the books
Display “Enter number of courses taken” and Input
FALSE
T
Input price of each book (bookPrice) and calculate total price (totalPrice)
RUE
Display total price (totalPrice)
Display shipping options
Pick up Delivery
Add shippingCharges to totalPrice. Display totalPrice
Display totalPrice and message of pickup at bookstore
Page 4