Question: 2. // MAINTENANCE10 // This program accepts data about 100 books and // determines a price for each. // The price is 10 cents per

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

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!