Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Help Needed! Please check requirements. Thanks! we are going to be reading and storing information about comic books. This data comes from http://www.comiclist.com (Links

C++ Help Needed! Please check requirements. Thanks!

we are going to be reading and storing information about comic books. This data comes from http://www.comiclist.com (Links to an external site.)Links to an external site. and is just a copy and paste of their text listing of new comics. So youll be reading the data related to comic book and storing that data in an array of that struct type. For full credit youll use a dynamic array of structs that grows when its full. There is a provision to allow for the use of a static array for a passing grade, just not full credit.

Input

The input to the program will be a series of commands. The commands will be detailed below. The basic ideas are to load in a set of comic information, then be able to search, add or purchase the comics.

Commands

load - this command will be followed by a filename. The filename is the list of comics to read and store in the array. This may or may not be the first command and it could come more than once.

search - this command will be followed by one of two search terms. The two search terms are PUBLISHER and TITLE. If another search term is given then an error is output.

If the PUBLISHER search term is given then we are searching for a complete match of the publisher for the comic. (e.g use == to compare). If the publisher is found, then the information for that comic is displayed.

If the TITLE search term is given then we are searching for a partial match of the given title. (e.g. use find on the title.). If the title is found, then information about the comic is displayed.

In any case, if the title or publisher isnt found, then a message is displayed about not finding what was searched for.

add - this command will be followed by a new comic book to be added to the list of comics. It is added at the end.

purchase - this command attempts to find the given title, by a complete match, and then if the comic has a value for its cost that isnt AR, then a cost is computed. The number after the title is how many of that comic you want to purchase. In the output you will list the comic information, the number purchased and what that cost would be. After the last purchased comic you list a total. If an individual title isnt found an error is displayed.

Heres a sample of what that could look like:

load 2015_24_06.csv search PUBLISHER MARVEL COMICS search TITLE Star Wars add 05/19/17,McPherson Publishing,Diary of a Programmer,$5.99 purchase Diary of a Programmer,5 Let's Dance A Waltz Volume 2 GN,1 Secret Avengers Volume 3 God Level TP,2 Planet Hulk #2 (Yildiray Cinar Variant Cover),3 search PUBLISHER MARVEL search TITLE Star Wars! purchase Diary of a Programmr,5 Let's Dance A Waltz Volume 2,1 Secret Avengers Volume God Level TP,2 search CANTFINDME nope 

A note about the purchase command the title for each comic to be purchased if ended with a comma. You can use this with the getline to be able to read the title. Then after the comma is a number indicating how many you want to purchase. Then there will be a space.

Each of the commands is a single word, you should use extraction to read them. After each command is a single space, in many of the cases youll need to ignore that space to make the command be able to find. For example, Title is not the same as Title.

The format for the comic after the add command is the same format as the file you load, a function to read a single comment is a good idea.

Each command is terminated with a newline character.

Output

Each command will have output. Firstly each command is echoed so that you can see what the command was. The only exception to this is the purchase command. The echoing of that command is mixed in with the results for the command.

If the command file above is run this is the output:

Command: load 2015_24_06.csv Loaded: 441 Command: search PUBLISHER MARVEL COMICS RELEASE DATE,PUBLISHER,TITLE,PRICE 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Blank Variant Cover),AR 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Carlos Pacheco Regular Cover),$3.99 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Nathan Fox Marvel's Agents Of S.H.I.E.L.D. Variant Cover),AR 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Pat Broderick Ant-Sized Variant Cover),AR 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Rock-He Kim Variant Cover),AR 06/24/15,MARVEL COMICS,Age Of Ultron Vs Marvel Zombies #1 (Skottie Young Variant Cover),AR 06/24/15,MARVEL COMICS,All-New Captain America Fear Him TP,$17.99 06/24/15,MARVEL COMICS,All-New Captain America Volume 1 Hydra Ascendant Premiere HC (Alex Ross Direct Market Cover),$24.99 06/24/15,MARVEL COMICS,All-New Captain America Volume 1 Hydra Ascendant Premiere HC (Stuart Immonen Book Market Cover),$24.99 06/24/15,MARVEL COMICS,Ant-Man Giant-Man Epic Collection Volume 1 The Man In Ant Hill TP,$34.99 06/24/15,MARVEL COMICS,Ant-Man Larger Than Life #1,$3.99 06/24/15,MARVEL COMICS,Ant-Man Natural Enemy Prose Novel HC,$24.99 06/24/15,MARVEL COMICS,Ant-Man Volume 1 Second-Chance Man TP,$15.99 06/24/15,MARVEL COMICS,Black Widow #19 (Dan Hipp Black Widsgwen Variant Cover),AR 06/24/15,MARVEL COMICS,Black Widow #19 (Phil Noto Regular Cover),$3.99 06/24/15,MARVEL COMICS,Cyclops Volume 2 A Pirate's Life For Me TP,$19.99 06/24/15,MARVEL COMICS,Daredevil #16 (Alex Maleev NYC Variant Cover),AR 06/24/15,MARVEL COMICS,Daredevil #16 (Chris Samnee Regular Cover),$3.99 06/24/15,MARVEL COMICS,Darth Vader #2 (Adi Granov 4th Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Darth Vader #3 (Adi Granov 3rd Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Darth Vader #4 (Adi Granov 3rd Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,E Is For Extinction #1 (Ian Bertram Regular Cover),$4.99 06/24/15,MARVEL COMICS,E Is For Extinction #1 (James Harren Variant Cover),AR 06/24/15,MARVEL COMICS,E Is For Extinction #1 (John Tyler Christopher Action Figure Variant Cover),AR 06/24/15,MARVEL COMICS,Howard The Duck #4 (Ed McGuinness Variant Cover),AR 06/24/15,MARVEL COMICS,Howard The Duck #4 (Jason Latour Gwen The Duck Variant Cover),AR 06/24/15,MARVEL COMICS,Howard The Duck #4 (Joe Quinones Regular Cover),$3.99 06/24/15,MARVEL COMICS,Howard The Duck The Complete Collection Volume 1 TP,$34.99 06/24/15,MARVEL COMICS,Infinity Gauntlet #2 (Dustin Weaver Regular Cover),$3.99 06/24/15,MARVEL COMICS,Infinity Gauntlet #2 (W. Scott Forbes Variant Cover),AR 06/24/15,MARVEL COMICS,Korvac Saga #1 (Otto Schmidt Regular Cover),$3.99 06/24/15,MARVEL COMICS,Korvac Saga #1 (Steve Lieber Variant Cover),AR 06/24/15,MARVEL COMICS,Loki Agent Of Asgard #15,$3.99 06/24/15,MARVEL COMICS,M.O.D.O.K. Assassin #2 (Of 5)(Christian Ward Variant Cover),AR 06/24/15,MARVEL COMICS,M.O.D.O.K. Assassin #2 (Of 5)(David Lafuente Regular Cover),$3.99 06/24/15,MARVEL COMICS,Marvel Previews #143 (July 2015 For Products On-Sale September 2015),$1.25 06/24/15,MARVEL COMICS,Marvel Universe Ultimate Spider-Man Web Warriors #8,$2.99 06/24/15,MARVEL COMICS,Marvel's Agent Carter Season One Declassified Slipcase HC,$49.99 06/24/15,MARVEL COMICS,Planet Hulk #2 (Mike Del Mundo Regular Cover),$3.99 06/24/15,MARVEL COMICS,Planet Hulk #2 (Yildiray Cinar Variant Cover),AR 06/24/15,MARVEL COMICS,Punisher #19,$3.99 06/24/15,MARVEL COMICS,S.H.I.E.L.D. #7 (Julian Totino Tedesco Regular Cover),$3.99 06/24/15,MARVEL COMICS,S.H.I.E.L.D. #7 (Robbi Rodriguez Gwendok Variant Cover),AR 06/24/15,MARVEL COMICS,S.H.I.E.L.D. #7 (Ryan Sook Marvel's Agents Of S.H.I.E.L.D. Variant Cover),AR 06/24/15,MARVEL COMICS,Secret Avengers Volume 3 God Level TP,$16.99 06/24/15,MARVEL COMICS,Secret Wars #1 (Of 8)(Alex Ross Gold Signature Edition)(Dynamic Forces),AR 06/24/15,MARVEL COMICS,Secret Wars #1 (Of 8)(Alex Ross Signed Edition)(Dynamic Forces),AR 06/24/15,MARVEL COMICS,Secret Wars #2 (Of 8)(Alex Ross 2nd Printing Variant Cover),$4.99 06/24/15,MARVEL COMICS,Spider-Gwen #1 (Javier Rodriguez 3rd Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Spider-Gwen #2 (Javier Rodriguez 3rd Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Star Wars #2 (John Cassaday 5th Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Unbeatable Squirrel Girl #5 (Erica Henderson 2nd Printing Variant Cover),$3.99 06/24/15,MARVEL COMICS,Uncanny Avengers #5 (Kris Anka Regular Cover),$3.99 06/24/15,MARVEL COMICS,Uncanny Avengers #5 (Todd Nauck NYC Variant Cover),AR 06/24/15,MARVEL COMICS,Where Monsters Dwell #2 (Of 5),$3.99 06/24/15,MARVEL COMICS,X-Men '92 #1 (Blank Variant Cover),AR 06/24/15,MARVEL COMICS,X-Men '92 #1 (David Nakayama Variant Cover),AR 06/24/15,MARVEL COMICS,X-Men '92 #1 (Pepe Larraz Regular Cover),$4.99 06/24/15,MARVEL COMICS,X-Men '92 #1 (Ryan Stegman X-Gwen Variant Cover),AR 06/24/15,MARVEL COMICS,X-Men '92 #1 (Skottie Young Variant Cover),AR 06/24/15,MARVEL COMICS,X-Men '92 #1 (Zhang Chin Ant-Sized Variant Cover),AR Command: search TITLE Star Wars RELEASE DATE,PUBLISHER,TITLE,PRICE 06/24/15,MARVEL COMICS,Star Wars #2 (John Cassaday 5th Printing Variant Cover),$3.99 06/24/15,Games - FANTASY FLIGHT PUBLISHING,Star Wars RPG Age Of Rebellion Desperate Allies Sourcebook,$29.95 06/24/15,Games - FANTASY FLIGHT PUBLISHING,Star Wars RPG Force And Destiny Beginner Game,$29.95 06/24/15,Merchandise,Star Wars Black 6-Inch Action Figure Assortment 201501,AR 06/24/15,Merchandise,Star Wars Black 6-Inch Action Figure Assortment 201503,AR 06/24/15,Merchandise,Star Wars Extermination White T-Shirt MED,$19.99 06/24/15,Merchandise,Star Wars Extermination White T-Shirt SM,$19.99 06/24/15,Merchandise,Star Wars Extermination White T-Shirt XXL,$21.99 06/24/15,Merchandise,Star Wars Mission Series Action Figure Assortment 201503,AR Command: add 05/19/17,McPherson Publishing,Diary of a Programmer,$5.99 Command: purchase RELEASE DATE,PUBLISHER,TITLE,PRICE 05/19/17,McPherson Publishing,Diary of a Programmer,$5.99,5,$29.95 06/24/15,KODANSHA COMICS,Let's Dance A Waltz Volume 2 GN,$10.99,1,$10.99 06/24/15,MARVEL COMICS,Secret Avengers Volume 3 God Level TP,$16.99,2,$33.98 06/24/15,MARVEL COMICS,Planet Hulk #2 (Yildiray Cinar Variant Cover),AR,3,AR Total: $74.92 Command: search PUBLISHER MARVEL Sorry, MARVEL not found. Command: search TITLE Star Wars! Sorry, Star Wars! not found. Command: purchase Sorry, Diary of a Programmr not found. Sorry, Let's Dance A Waltz Volume 2 not found. Sorry, Secret Avengers Volume God Level TP not found. Command: search CANTFINDME nope Unknown search term: CANTFINDME Sorry, nope not found. 

The end of this shows the negative results for each of the commands. Again, spacing on a line doesnt matter. As long as you have at least a space where I do, youre fine. If you have space where I dont or if you dont have space where I do, then youre not fine.

Requirements

You must declare the function void comicList( string input, string output ); in a file called comicList.h

You must create a struct for the comic book information.

You must create an array of that struct you made for requirement 1.

If you want full credit, the array of that struct must be dynamically allocated using a pointer.

When the array is full, you will double it before adding new data to the array.

You may not use smart pointers.

You may not use vector, list, or other STL storage container classes.

You may not use classes.

You must write functions for the major commands and other functions as appropriate.

You may not use global variables.

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

What is the mass of 43.1 mol phosphorus pentachloride?

Answered: 1 week ago