Book Database Implementation C++

In summary, you have created two classes, bookClass and courseClass, to store information about books and courses respectively. The private members of each class represent the data and the public members should contain methods that operate on the data. You will need to create functions to handle user input and store each book and course instance in a vector or array.
  • #1
carl123
56
0
1.PNG
2.PNG


I began by creating 2 classes. A book class and a course class that contains any necessary info about the book and course respectively

Code:
class bookClass{
    private:
        string theISBN;
        string thebookName;
        string thebookAuthor;
        double thebookCost;
        int thebookEdition;
        char bookFormat;
       
       
    public:
       
}

class courseClass{
    private:
        string deptCode;
        string courseName;
        int courseNum;
        int secNum
       
    public:
       
}

I'm new to C++. This is how I've began and not sure how to continue. My question are as follows:

1. Am I on the right track so far?
2. If so, what is the public supposed to contain for each class?
3. How do I store to user input in vectors that should hold the book information

I'm not requesting for the solution to be handed to me. I just need a nudge in the right direction. Thanks
 
Physics news on Phys.org
  • #2
carl123 said:
View attachment 211059 View attachment 211060

I began by creating 2 classes. A book class and a course class that contains any necessary info about the book and course respectively

Code:
class bookClass{
    private:
        string theISBN;
        string thebookName;
        string thebookAuthor;
        double thebookCost;
        int thebookEdition;
        char bookFormat;
      
      
    public:
      
}

class courseClass{
    private:
        string deptCode;
        string courseName;
        int courseNum;
        int secNum
      
    public:
      
}

I'm new to C++. This is how I've began and not sure how to continue. My question are as follows:

1. Am I on the right track so far?
Pretty much. The private members of your class represent the data for a given book or course.
carl123 said:
2. If so, what is the public supposed to contain for each class?
The public members of each class should be the methods that operate on the data. Users of the class will need to call the class methods for various operations, rather than directly manipulate the class data members. This is called data hiding.
carl123 said:
3. How do I store to user input in vectors that should hold the book information
You don't, as I read the problem. You will need a function that takes a string of one or two characters, and then calls the appropriate method, passing the information that the method needs, as parameters to the method. I don't see any requirement to store user input in a vector. However, after each book instance is created, it should be stored in a vector or array. You'll need to do the same for each course instance that you construct.
carl123 said:
I'm not requesting for the solution to be handed to me. I just need a nudge in the right direction. Thanks
 

What is a book database implementation in C++?

A book database implementation in C++ is a program that allows users to store and retrieve information about books in a systematic manner. It typically involves creating a database structure, designing user interfaces for adding and managing book data, and implementing algorithms for searching and sorting books.

Why is C++ a popular language for book database implementation?

C++ is a popular language for book database implementation because it is a high-level programming language that offers powerful features such as object-oriented programming, memory management, and efficient data structures. It is also known for its speed and performance, making it well-suited for handling large amounts of data.

What are the key components of a book database implementation in C++?

The key components of a book database implementation in C++ include data structures for storing book information, user interfaces for adding and managing book data, algorithms for searching and sorting books, and error handling mechanisms. Other important components may include data validation and data backup features.

How do you create a book database in C++?

To create a book database in C++, you will need to design a database structure that includes fields for book title, author, genre, publisher, publication date, and other relevant information. Then, you can use C++ programming techniques to implement the database structure and develop user interfaces for adding, editing, and querying book data.

What are some best practices for implementing a book database in C++?

Some best practices for implementing a book database in C++ include using efficient data structures, following good coding practices such as modularity and commenting, implementing error handling mechanisms, and testing the program thoroughly. It is also important to regularly backup the database and ensure data integrity through proper data validation techniques.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
989
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Programming and Computer Science
3
Replies
89
Views
4K
  • Programming and Computer Science
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
3K
  • Programming and Computer Science
Replies
17
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top