Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C++ function that preforms the following. load in the data file so that you can have access to the information later to compute

Create a C++ function that preforms the following. load in the data file so that you can have access to the information later to compute search in the book library for titles and authors, and chapters as well as an overview.(Only help with the overview request) The use of pointers, classes, or global variables will result in an automatic failure.

Below is an example of how the data files will be formatted/ tested with your code. Some files will be larger than others where some will only have one title and others will have hundreds. Note how the end of the book chapters list ends with the book title.

Pet Sematary

Stephen King

01 The Pet Sematary

02 The MicMac Burying Ground

03 Oz the Gweat and Tewwible

Pet Sematary

Diary of a Wimpy Kid

Jeff Kinney

01 Introduction

02 Word Study

03 Rodricks day off

04 Summer Break

05 Water Park Disaster

06 The start of High School

Diary of a Wimpy Kid

Charlottes Web

E.B. White

01 The itsy bitsy spider

Charlottes Web

Diary of a wimpy kid : Last year of school

Jeff Kinney

01 The first last day

02 sprint break

03 The cheese is gone

04 Prom

Diary of a wimpy kid : Last year of school

Example output below (User input is highlighted):

Welcome to the Mobile Library

Enter a request:

download books.txt

Enter a request:

Search book Pet Sematary

Your request was found in the book: Pet Sematary

Enter a request:

Search author Jeff Kinney

Your request was found in the book: Diary of a Wimpy Kid

Enter a request:

Search chapter The itsy bitsy spider

Your request was found in book: Charlottes Web

File overview

Book Overview

----------------------

Total books: 4

Total unique authors: 3

Total chapters: 14

I only need help with the overview function, I have provided the code for it below, please complete it.

// Structure to store book information struct Book { string title; string author; vector chapters; };

// Function to display file overview void displayFileOverview(map &books) { cout << "File Overview" << endl; cout << "----------------------" << endl; cout << "Total books: " << books.size() << endl;

int uniqueAuthors = 0; map authorCount;

for (auto const &book : books) { if (authorCount[book.second.author] == 0) { uniqueAuthors++; }

authorCount[book.second.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

explain what is meant by redundancy

Answered: 1 week ago