Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Program in C++ Description: You are an avid reader and have decided that you would like to keep track of the books that you

Write Program in C++

Description:

You are an avid reader and have decided that you would like to keep track of the books that you read. You will define a structure called book_list that will hold

1. a number associated with each book (int),

2. book title (string),

3. author (string),

4. a description of the book (string),

5. a date when the book was read stored in 2 parts month (int) and year (int) a

6. a rating of the book (int).

The number will be generated by the program as each book is entered. The rating should be limited to a number between 1 and 10. It will be a scale the user can use to enter what they thought of the book. The month should be a valid month and the year should be less than the current year and not negative.

The program should ask the user for all of the book information, except for the number, until the user enters exit as the book title. After each book is entered, it should be written to an output file called reading_list.txt. The file should contain all of the information including the number for each book. Each item of the book should be printed on a new line. Each time the program is restarted, it should open the file to append to the end of the file.

Structure member definitions:

Book number to be generated by the programmer for each new book that is entered

Book title This should be able to hold spaces

Author should be able to hold spaces

Description should be able to hold spaces

Date should be a month stored as 1 12 and year stored with all four digits, i.e. 2017. It should be printed as XX XXXX i.e 9 2016 when printing it to the file.

Rating should be a number between 1 and 10

Requirements:

The title, author, and description should be able to contain spaces.

Book numbers must start with 1 and be generated by the program

Sample input:

Enter title: Les Miserables

Enter author: Victor Hugo

Enter description: A convict changes his life

Enter month: 01

Enter year: 2017

Enter rating: 9

Enter title: exit

Sample file output:

Les Miserables

Victor Hugo A

convict changes his life

01 2017

9

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions