Kat H.

asked • 06/28/21

Write in C++ at the Linux command line a collection program that keeps track of a collection of information.

Introduction

Write in C++ at the Linux command line a collection program that keeps track of a collection of information. You can come up with your own idea of what information to store in the collection. Whatever idea you come up with, it must be complex enough to require an array of structs with at least three fields. See requirements for more details.


  1. movie collection
  2. book collection
  3. video game collection
  4. todo list
  5. DnD possessions (weapons, treasure, etc.) list.

I have an output example of a book collection manager below. This shows the level of complexity that your own program should have to get full credit. If are unsure on what to do, you can use this as your project's theme.


Whatever you do, try and keep it reasonably simple to do. Your work will be looked at on how well you follow the listed requirements.


Also make sure you keep the source code when you are done as you will need it for the future.


REQUIREMENTS


The following are in addition to the above general requirements

Tasks


Your program should have as a minimum the following tasks:


1. Allow the user to add entries to the collection. Check for valid data and let the user re-enter if they enter invalid data. Please let the user know what is valid data. For example, if the program needs a number between 1 and 100 let the user know in the prompt that they need to enter a number between 1 and 100.


So what is invalid data? I'm letting students define that but at a minimum whatever a user inputs should NOT cause your program to malfunction or crash (ie get a run-time error). So at least check for input that might cause your program not run correctly or crash. However, it doesn't hurt to catch obvious invalid data (e.g. negative years or prices) so the user can re-type them. if you want to you can ask the user if the data entered is okay and then allow them to re-enter.


2. Allow the user to print out the entire collection. Should not print out blank entries or invalid entries.


3. Allow the user to delete an entry from the collection. Allow users to choose which entry to delete. This can be by index (do print out the entries with their indices so the user can know what entry goes with what index). OR you can let them enter a search value and then search for that entry. If the entry is not found, do print out an error message, don't just do nothing. You can ask the user to re-enter or you can just return to the main function. Also, if you are using an index into the array, make sure this is a valid index to valid data.


Other tasks can be added but only if the above tasks are also present and working correctly. However, extra tasks will be graded for completeness and correctness so make sure they work too.


Code Requirements


The program also needs to have the following code structures:


1. An array of structs. The struct needs to be defined with at least 3 fields. At least one field should be numeric (integer or floating point) and at least one field should be a C string type (no C++ string type please). Please no parallel arrays (more than one array of simple types) for storing the collection.


2. A header file with your struct definition in it. Name the file after your struct name in all lower-case letters to prevent case-conflict issues.


3. Need to have at least one separate function for each task. Please try to break up your function tasks into smaller functions if they are getting long. Remember there is a 30 line requirement for all functions including the main function.


4. No global variables or goto's. See C++ Coding Guidelines under the Course Information module for styling and comment requirements.



Patrick B.

Please email for all of the source code... there are 3 files stock.h, stock.cpp and of course main. THey will not all fit here. I was only able to post the header, and half the source code for stock.cpp file. Missing is the report writing routine and the main/driver. click on my profile picture and there is a link to email. I will save the source code for you.
Report

06/29/21

Patrick B.

Am also reading/writing the stock data to and from disk file because I do not to have to input over and over every time the program runs
Report

06/29/21

1 Expert Answer

By:

Patrick B. answered • 06/29/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.