Book Database Implementation C++

Click For Summary
SUMMARY

The discussion focuses on implementing a book and course database using C++ classes. The user has created two classes: bookClass and courseClass, which encapsulate the necessary attributes for books and courses, respectively. Key insights include the importance of defining public methods for data manipulation and the necessity of storing instances in vectors or arrays after creation. The user seeks guidance on structuring public methods and handling user input effectively.

PREREQUISITES
  • Understanding of C++ class structure and encapsulation
  • Familiarity with C++ vectors for dynamic data storage
  • Basic knowledge of data hiding principles in object-oriented programming
  • Experience with user input handling in C++
NEXT STEPS
  • Research C++ class member functions and their implementation
  • Learn about C++ vectors and how to manipulate them
  • Explore data hiding and encapsulation in object-oriented programming
  • Study user input handling techniques in C++
USEFUL FOR

Beginner C++ programmers, software developers interested in object-oriented design, and anyone looking to implement a basic database structure using C++ classes.

carl123
Messages
55
Reaction score
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
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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 7 ·
Replies
7
Views
7K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K