For this assignment, you will create a program that records information for a bo
ID: 3760984 • Letter: F
Question
For this assignment, you will create a program that records information for a book sale. You may assume that there will be 1000 books sold at the sale. You will use parallel arrays to record each book that will be sold in the sale. You will need to record each book's title, author, and price in three parallel arrays. Your program will then output a list of all of the books that will be sold, with column headers that are separated by 10 spaces. Your program will also separately output the total sales that will be generated if all of the books are sold at the listed price.
BASIC PSEUDOCODE ONLY PLEASE
Explanation / Answer
Step1: Create the array variables bookTitle, author and price having maximum of 1000 values.
String bookTitle[1000], authorName[1000], bookStatus[1000];
double price[1000], totalPrice = 0;
Step2: Enter the records of books parallely in 3 arrays.
for i =1 to 1000 do
input ( bookTitle[i], authorName[i], price[i] );
Step3: Print the list of all of the books that will be sold, with column headers that are separated by 10 spaces.
for i =1 to 1000 do
if (bookStatus[i] == "Sold") do {
print ( bookTitle[i], " ", authorName[i], " ", price[i], " " );
// we use' ' for long spaces(upto 10 spaces) and ' ' for new line
totalPrice = totalPrice + price[i];
}
Step4: Print the total sales that will be generated if all of the books are sold at the listed price.
print("The total sales done by selling books is : ", totalPrice);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.