Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language c++ Question 3 : [35 Points) You have to write program for IIUI bookshop that sells two types of books, fiction and non fiction.

image text in transcribed

Language c++

Question 3 : [35 Points) You have to write program for IIUI bookshop that sells two types of books, fiction and non fiction. Create a base class named Book. Data fields include id, title, price and number of copies. Derive two classes from the Book class: Fiction, which also contains a numeric grade reading level, and NonFiction, which contains a variable to hold the number of pages. Each of these three classes has a Parameterized constructor to initialize data fields with user-defined values showData() functions that displays data members isExpensive () is a pure virtual function in Book class. Let's assume Fiction with price more than 1000 and NonFiction with price exceeding 1500 is considered expensive. Program will read a text file that stores information of all the books For Fiction it stores f:id:title:price:no of copies: level For Nonfiction it stores n:id:title:price: no of copies:pages Consider following file contents as an example f:3456: The Hunger Games : 4500:25:15 n:2341: To kill a Mockingbird:530:12:1000 f:3216: The Harry Potter:5000:11:13 Create a Record class that creates an array of pointers to Book. In a loop, read a file line by line, use new to create an object of type Nonfiction and Fiction to hold the data. Put the pointer to the object in the array. After reading the text file provide following menu options to the user. Display information of all the books currently available in a store Place an Order When customer comes in take his order. Check quantity and then decide whether required book is available or not. If it is available, book will be sold, number of copies will be updated and bill amount is calculated. Customer could opt to place an order of multiple books. Find book by title Finished books Display information of all books that are finished and are required to be purchased Get total amount At the end of the day, they want to know total sales of day that is found by adding bill amount of each customer Exit

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions