Answer:
Check the explanation
Step-by-step explanation:
Begin class Books:
string title
num pages
num price
num MIN_PAGES=200
num HIGH_PRICE=0.10
num LOW_PRICE=0.8 Books(title, page)
title= title
pages=page
price=0.0
end of constructor
string getTitle()
return title
end of getTitle
num getPages()
return pages
end of getPages
num getPrice()
if(pages<=MIN_PAGES)
price=getPages()*HIGH_PRICE
else
price=MIN_PAGES*HIGH_PRICE+(pages-MIN_PAGES)*LOW_PRICE
end of if
return price
end of getPrice
string toString()
string s=""
s+="Title: "+getTitle()
s+="\\Pages: "+getPages()
s+="\\Price: "+getPrice()
return s
end of toString
end Books class
start
class BooksImplementation
main()
Declarations
Books books[100]
num size
string title
num pages
output "Enter the size of the Books array: "
input size
for i=0; i<size; i++
output "Enter Book title: "
input title
output "Enter number of pages in the book: "
input pages
books[i]=new Books(title, pages)
end of for
output "The details of book and it prices are: ")
for int i=0; i<size ; i++
output "Book "+(i+1)+": "
output books[i].toString()
end of for
end of main
end of class
stop