Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

// MAINTENANCE10

// 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.

// Create a Book class and modify the program to use

// an array of Book objects instead of individual

// data items.

start

Declarations

num SIZE = 100

num sub

string titles[SIZE]

num pages[SIZE]

num prices[SIZE]

num MIN_PAGES = 200

num HIGH_PRICE = 0.10

num LOW_PRICE = 0.08

sub = 0

while sub < SIZE

output "Enter title "

input title[sub]

output "Enter pages "

input pages[sub]

if pages[sub] <= MIN_PAGES then

price[sub] = pages[sub] * HIGH_PRICE

else

price[sub] = MIN_PAGES * HIGH_PRICE +

(pages[sub] MIN_PAGES) * LOW_PRICE

endif

endwhile

displayBooks(titles, pages, prices, SIZE)

stop

void displayBooks(string[] titles, num[] pages, num[] prices, num SIZE)

Declarations

int x

x = 0

while x < SIZE

output "Title: ", titles[x]

output "Pages: ", pages[x]

output "Price: ", prices[x]

x = x + 1

endwhile

return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions