Question: Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the

Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the comments (lines that begin with two slashes) at the beginning of the code. Your job is to alter the pseudocode to meet the new specifications as noted above
// This program accepts data about 100 books and determines a price for
// each. The price is 10 cents per page for the first 200 pages, then 8
// cents per page after that. After pricing, all the data is displayed.
// The user has created a Book class with some methods but there are
// some errors that need fixing.
start
// Declarations
num SIZE =100
Book books[]
num sub
sub =0
while sub <= SIZE
books[]= getBookValues(sub)
sub = sub +1
end
displayBooks(books, sub)
stop
private static Book getBookValues()
// Declarations
Book book
string title
num pages
num price
num MIN_PAGES =200
num HIGH_PRICE =0.10
num LOW_PRICE =0.08
output "Enter title ..."
output title
output "Enter pages ..."
output pages
book.setTitle(pages)
book.setPages(title)
if pages < MIN_PAGES then
price = pages + HIGH_PRICE
elseif
price = MIN_PAGES + HIGH_PRICE +(pages MIN_PAGES)+ LOW_PRICE
end
book.setPrice(price)
return item
public static void displayBooks(Book[] books, num SIZE)
// Declarations
int x
x =0
while x <= SIZE
output "Title: ", books[SIZE].getTitle()
output "Pages: ", books[SIZE].getPages()
output "Price: ", books[SIZE].getPrice()
x = x +1
end
return
class Book
// Declarations
private string title
private num pages
private num price
public void setTitle(int bookTitle)
title = booktitle
return
public int setPages(num pages)
this.pages = pages
return
public int setPrice(num pr)
pr = price
return
public int getTitle()
return title
public int getPages()
return pages
public int getPrice()
return price
endClass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!