Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Educated Bookstore Company has asked you to help them write a Book Purchasing System ( BPS ). The system can be used to store

The Educated Bookstore Company has asked you to help them write a Book Purchasing System (BPS). The system can be used to store information about books, customers, members, and selling records (books already bought by a customer/member). A customer is a person who buy books from the bookstore while a member is a VIP customer who are given discount when buys books.

The following data about books (ISBN, Title, Author, Price) are saved in a file book.txt:

5-17-525281-3 C++ Programing, Davender Malik, 210

3-7908-1335-4 Discrete Structures, Davender Malik, 185

3-7908-1325-7 Fuzzy Mathematic, Davender Malik, 165

0-239-23635-0 Data Structures, Shih-Chung Cheng, 240

2-99521-453-1 Introduction to Web Programming, Mark Headington, 130

0-521-43681-8 English Grammar in Use, Raymond Murphy, 75

0-7637-8060-x JavaScript, John David Dionisio, 155

0-201-40015-4 Calculus and Analytic geometry, George B. Thomas, 280

0-19-431735-1 Oxford Wordpower, Oxford University, 37

0-86134-022-1 The Camera Book, Mitcheil Beazley, 45

The following data about customers/members (ID, Name, email, number of books) are saved in a file customer.txt, only the ISBNs are saved:

912345678 Saleh Al-Yaaroubi, 912345678@abc.ac.ae, 8

0-239-23635-0 2-99521-453-1 0-521-43681-8 0-7637-8060-x

3-7908-1335-4 0-201-40015-4 0-19-431735-1 3-7908-1325-7

567891234 Khaulah Al-Lawati, 567891234@abc.ac.ae, 1

0-521-43681-8

234567891 Amal Al-Waili, 234567891@abc.ac.ae, 4

0-7637-8060-x 0-201-40015-4 3-7908-1325-7 0-239-23635-0

345678912 Sharifa Al-Mahroqi, 345678912@abc.ac.ae, 7

3-7908-1335-4 5-17-525281-3 0-7637-8060-x 0-19-431735-1

0-521-43681-8 0-86134-022-1 3-7908-1325-7

789123456 Arif Al-Waili, 789123456@abc.ac.ae, 6

3-7908-1325-7 2-99521-453-1 0-521-43681-8 5-17-525281-3

0-86134-022-1 0-201-40015-4

891234567 Abdullah Al-Harthi, 891234567@abc.ac.ae, 3

0-19-431735-1 3-7908-1325-7 0-7637-8060-x

132456789 Talal Al-Zidjali, 132456789@abc.ac.ae, 6

0-521-43681-8 0-19-431735-1 5-17-525281-3 0-201-40015-4

0-86134-022-1 3-7908-1325-7

123456789 Taghreed Al-Saadi, 123456789@abc.ac.ae, 3

2-99521-453-1 5-17-525281-3 0-19-431735-1

678912345 Suleiman Al-Lawati, 678912345@abc.ac.ae, 4

2-99521-453-1 3-7908-1335-4 0-86134-022-1 0-521-43681-8

456789123 Suad Al-Saadi, 456789123@abc.ac.ae, 2

0-239-23635-0 0-19-431735-1

a. Define a struct called book that has the components (ISBN, title, author, and price).

b. Define a class called Customer that has the private members (ID, name, email, numberOfBooks, an array books[ ] of type book, totalCost) and the function calculateCost( ) that finds the total cost of bought books. The class has the public members set( ), print( ), getTotalCost( ), and a default parametrized constructor. Implement all member functions of the class.

d .Define a class called Member which publicly inherits the class Customer and has the private members discount, netCost, and the function calculateNetCost( ). The class has the public members set( ), print( ), and a default parametrized constructor. Implement all member functions of the class.

Use the following driver:

int main()

{

Customer w("789123456");

Member VIP("789123456", 20);

w.print();

VIP.print();

return 0;

}

Sample input / output:

image text in transcribed

789123456 Arif Al-Waili 789123456@abc.ac.ae Bought the following 6 books 3-7908-1325-7 Fuzzy Mathematic 2-99521-453-1 Introduction to Web Programming 0-521-43681-8 English Grammar in Use 5-17-525281-3 C++ Programing 0-86134-02 0-201-40015-4 Calculus and Analytic geometry Davender Malik Mark Headingtor Raymond Murphy Davender Malik Mitcheil Beazley George B. Thomas 2-1 The Camera Book The cost of the above books is 905 dirhams 789123456 Arif Al-Waili 789123456@abc.ac.ae Bought the following 6 books 3-7908-1325-7 Fuzzy Mathematic 2-99521-453-1 Introduction to Web Programming 0-521-43681-8 English Grammar in Use 5-17-525281-3 C++ Programing 0-86134-02 0-201-40015-4 Calculus and Analytic geometry Davender Malik Mark Headingtor Raymond Murphy Davender Malik Mitcheil Beazley George B. Thomas 2-1 The Camera Book The cost of the above books is 905 dirhams This customer is a member and has a 20% discount The net cost of this member is 724 dirhams 789123456 Arif Al-Waili 789123456@abc.ac.ae Bought the following 6 books 3-7908-1325-7 Fuzzy Mathematic 2-99521-453-1 Introduction to Web Programming 0-521-43681-8 English Grammar in Use 5-17-525281-3 C++ Programing 0-86134-02 0-201-40015-4 Calculus and Analytic geometry Davender Malik Mark Headingtor Raymond Murphy Davender Malik Mitcheil Beazley George B. Thomas 2-1 The Camera Book The cost of the above books is 905 dirhams 789123456 Arif Al-Waili 789123456@abc.ac.ae Bought the following 6 books 3-7908-1325-7 Fuzzy Mathematic 2-99521-453-1 Introduction to Web Programming 0-521-43681-8 English Grammar in Use 5-17-525281-3 C++ Programing 0-86134-02 0-201-40015-4 Calculus and Analytic geometry Davender Malik Mark Headingtor Raymond Murphy Davender Malik Mitcheil Beazley George B. Thomas 2-1 The Camera Book The cost of the above books is 905 dirhams This customer is a member and has a 20% discount The net cost of this member is 724 dirhams

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago