Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write this program in C++ with comments please Assignment #1 Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: The
Write this program in C++ with comments please
Assignment \#1 Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: The major advantage of using structs is to make the C++ code simpler, easier to read, and easier to work with. After completing this assignment, students will be able to: - use structs to create and/or introduce new custom data types - implement structs to group fixed numbers of pieces of data of different types - implement structs within structs - chaining using the dot operators to access nested fields - copy an entire structure - create an array of a structured data type - combine structs and arrays with one another Program Description: Mary has found a collection of books (Books.txt) and a list of her favorite authors (Authors.txt). Your goal is to write a program for Mary, that allows her to browse both the book list and her favorite author list. The program should also display books written by her favorite authors in addition to their nationality which she does not know. The main() function should only contain the Menu() function, which must display the available options. The program must only terminate upon the user's command (you can include this as an option). The rest of the functionality should be invoked through functions from within Menu()). There are two .txt files. Each line in a file corresponds to an entry. You should store all information on arrays dedicated to each file. Do NOT use global variables. If you do so there will be a deduction of 10 points from your total points. File Description: Books.txt 1. Book title 2. Author name 3. Year of publication in English language 4. Language originally written in 5. Genre Authors.txt 1. Name 2. Date of Birth 3. Most Notable Book Mary wants to be able to read the file. Create a Book struct that will retain all information that is present in the file. Create an array that will contain such information. From the first menu option, allow Mary to print the list. The underscores in the title and author name should be removed. Task 2: Similarly, Mary wants to print her favorite author List. Create an Author struct. Also, create a Date struct which will be an attribute of the Author struct, representing the date of birth. Finally, add a nationality attribute which will not be filled when reading the file. Just like in Task 1, create an authors array of type struct. From the second menu option, print the authors; the date of birth should exclude the day even though it is included in the file(whether the Date struct will contain a "day" attribute is up to you). The underscore in the author's name and most notable work should be removed. Task 3: Mary wants to find books by her favorite authors in the list. The third option in the menu, should print the author, his nationality (same as language book was originally written in), and the book title. There will only be one book matched for each author. Hints: When trying to remove the underscores, remember that a string is an array of characters, and that each character can be manipulated. Use separate functions for print and for reading. Please check the attached "Grading Rubric" for the grading criteria. Sample output of Tasks: 1. Print Books 2. Print Authors 3. Print Matches 4. Terminate Enter Selection: NameHarukiMurakamiFyodorDostoevskyLeoTolstoyAuthorsMatchedNationalityJapaneseRussianRussianBookNorwegianWoodTheBrothersKaramazovWarandPeace 1. Print Books 2. Print Authors 3. Print Matches 4. Terminate Enter SelectionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started