Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions