Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 18, Problem 6PP

Solution to Programming Project 18.6

In this project you are to create a database of books that are stored using a vector. Keep track of the author, title, and publication date of each book. Your program should have a main menu that allows the user to select from the following: (1) Add a book’s author, title, and date; (2) Print an alphabetical list of the books sorted by author; and (3) Quit. You must use a class to hold the data for each book. This class must hold three string fields: one to hold the author’s name, one for the publication date, and another to hold the book’s title. Store the entire database of books in a vector in which each vector element is a book class object. To sort the data, use the generic sort function from the <algorithm> library. Note that this requires you to define the < operator to compare two objects of type Book so that the author field from the two books are compared. A sample of the input/output behavior might look as follows. Your I/O need not look identical, this is just to give you an idea of the functionality.

Select from the following choices:

1. Add new book

2. Print listing sorted by author

3. Quit

1

Enter title:

More Than Human

Enter author:

Sturgeon, Theodore

Enter date:

1953

Select from the following choices:

1. Add new book

2. Print listing sorted by author

3. Quit

1

Enter title:

Problem Solving with C++

Enter author:

Savitch, Walter

Enter date:

2015

Select from the following choices:

1. Add new book

2. Print listing sorted by author

3. Quit

2

The books entered so far, sorted alphabetically by author are:

Savitch, Walter. Problem Solving with C++. 2015.

Sturgeon, Theodore. More Than Human. 1953.

Select from the following choices:

1. Add new book

2. Print listing sorted by author

3. Quit

1

Enter title:

At Home in the Universe

Enter author:

Kauffman

Enter date:

1996

Select from the following choices:

1. Add new book

2. Print listing sorted by author

3. Quit

2

The books entered so far, sorted alphabetically by artist are:

Kauffman, At Home in the Universe, 1996

Savitch, Walter. Problem Solving with C++. 2015.

Sturgeon, Theodore. More Than Human. 1953.

Blurred answer
Students have asked these similar questions
In C++Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey, and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then, it should create a report that includes the following information:     Average amount of food eaten per day by the whole family of monkeys.     The least amount of food eaten during the week by any one monkey.     The greatest amount of food eaten during the week by any one monkey. Write functions: average() least() greatest() main()
Assume numbers is a vector that contains these integers: 2 4 6 8 10 Then the following code executes: numbers.resize (9) ; numbers.resize (11, 5) ; What does the vector contain now? 11 11 11 11 11 0 0 0 0 2 4 6 8 10 0 0 0 0 2 4 6 8 10 5 5 2 4 6 8 10 0 0 0 0 11 11 11 11 11 5 5 0 0 0 0 2 4 6 8 10 O 2 4 6 8 10 0 0 0 0 5 5 Assume vec1 is a vector that contains these integers: 10 20 30 40 50 60 70 80 90 100 And vec2 is a vector that contains these integers: 3 6 9 12 15 Then the following code executes: vec1.resize (7); vec1.swap (vec2) ; What do the vectors contain now? vec1 contains 3 6 9 12 15 vec2 contains 10 20 30 40 50 60 70 vec1 contains 3 6 9 12 15 0 0 vec2 contains 10 20 30 40 50 60 70 vec1 contains 3 6 9 12 15 vec2 contains 50 60 70 80 90 100 vec1 contains 0 0 3 6 9 12 15 vec2 contains 50 60 70 80 90 100 O This code creates a compiler error.
Computer Science JAVASCRIPT .xlsx parser I need to write a public class that reads an .xlsx file and returns an array of data in javascript. The array would be all of the data inside of the file. The file itself is going to be inside of a folder(downloadedFIles) inside of my project. So the public class will need to account for that.

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License