In: Computer Science
According to the university's website design request, students need to order five books, one for each of the five required courses that all students take. You need to design a program that will prompt students for the price of each book and display the total cost for the five books.
The university reassessed its needs for the website design and determined it will no longer require all students to take five classes.
Update the website program to reflect the following changes:
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.
****This requires a lot of effort so please drop a like if you are satisfied with the solution****
I have written the pesudo code as comments in js code...
index.html:
<html>
<head>
<script src="index.js"></script>
</head>
<body></body>
</html>
index.js
// ->Declaration
// declare a variable to store no of no of subjects
// declare a variable i and intialise it to 1
// declare a variable to calculate and store the total price
// ->Reading input from prompts
// run a while until i is less than no of subjects
// read the price of books and add it to total_price
// increment i by 1
// ->checking shipping charges
// prompt the user to enter shipping details -> Delivery/pickup
// if read value is equal to "delivery"
// then add shipping charges 50 to the total price
// WritableStream total price
// else write total price
noOfSubjects=window.prompt("Enter number of subjects")
i=1
total_price=0
books=""
while(i<=noOfSubjects){
price=Number(window.prompt("Enter book "+i+" price"))
total_price+=price;
books+="book "+i+" price : "+price+"\n"
i+=1
}
shipping_cost=window.prompt("Delivery/Pickup ?")
if(shipping_cost.toLowerCase()=="delivery"){
console.log("here")
total_price+=50
books+="Shipping Charges : 50 "
document.write(books)
document.write("Total Price is : "+total_price)
}else{
books+="Shipping Charges : 0 "
document.write(books)
document.write("Total Price is : "+total_price)
}
Flow Chart: