Really need help building this check in and out library and book class

  • (2 Pages)
  • +
  • 1
  • 2

21 Replies - 1838 Views - Last Post: 11 March 2014 - 11:56 PM Rate Topic: -----

#16 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7915
  • View blog
  • Posts: 26,425
  • Joined: 05-May 12

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 08:22 PM

No you don't have to create your book 20 times. Your line of code:
Book myBooks[ 20 ];


already automatically creates the 20 books for you by calling the default constructor.

You should have covered this very basic bit of information while you were being introduced to C++ and before you were given this assignment. This is why in my previous post I was highly suspicious of the sophistication of your class definitions which included const correctness, exception thrown annotations, and streaming overrides, but then you then go turn around and ask how to implement the most simple function of checking in or checking out a book. Now you ask about how arrays and constructors work. There is a big disconnect.

Is there a chance you are jumping into this data structures class, but you didn't take a prerequisite intro to programming class and that is the cause of the disconnect?

Or perhaps you learned Java or Python as your first language or intro to programming class, and are just now switching to C++? That would answer the arrays and constructors question you posed, but still wouldn't explain the const correctness and stream overrides. The exception annotations may have come from Java experience.
Was This Post Helpful? 0
  • +
  • -

#17 secondmode   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-March 14

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 08:33 PM

View PostSkydiver, on 11 March 2014 - 08:22 PM, said:

No you don't have to create your book 20 times. Your line of code:
Book myBooks[ 20 ];


already automatically creates the 20 books for you by calling the default constructor.

You should have covered this very basic bit of information while you were being introduced to C++ and before you were given this assignment. This is why in my previous post I was highly suspicious of the sophistication of your class definitions which included const correctness, exception thrown annotations, and streaming overrides, but then you then go turn around and ask how to implement the most simple function of checking in or checking out a book. Now you ask about how arrays and constructors work. There is a big disconnect.

Is there a chance you are jumping into this data structures class, but you didn't take a prerequisite intro to programming class and that is the cause of the disconnect?

Or perhaps you learned Java or Python as your first language or intro to programming class, and are just now switching to C++? That would answer the arrays and constructors question you posed, but still wouldn't explain the const correctness and stream overrides. The exception annotations may have come from Java experience.


Skydiver, it's little bit of both. I don't have a strong foundation cause I was self-taught and I did start off with python. What I am confused about is people are willing to make time out to write sentences to bash, when they could at least spend a second of that portion of time to help out at least. Sigh.....
Was This Post Helpful? 0
  • +
  • -

#18 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7915
  • View blog
  • Posts: 26,425
  • Joined: 05-May 12

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 08:43 PM

The help is not very forthcoming because right now it almost looks like you were given a header file and a main.cpp, and you want us to write the class methods for you with the way you have been phrasing your questions. Or to quote the comment that was in stackoverflow before you retracted your question:

Quote

This looks like an interesting way to reword your homework problem.

Was This Post Helpful? 0
  • +
  • -

#19 secondmode   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-March 14

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 08:50 PM

View PostSkydiver, on 11 March 2014 - 08:43 PM, said:

The help is not very forthcoming because right now it almost looks like you were given a header file and a main.cpp, and you want us to write the class methods for you with the way you have been phrasing your questions. Or to quote the comment that was in stackoverflow before you retracted your question:

Quote

This looks like an interesting way to reword your homework problem.


You do realize if I just posted the request for help here, bashing is all I would have received in this forum. Thus, I posted it in stackoverflow as well. As for that person's comment, he is just like the same guy that yourself is very familiar with, just looking to not help but rather waste time on suspecting.
Was This Post Helpful? 0
  • +
  • -

#20 infernorthor   User is offline

  • D.I.C Lover

Reputation: 362
  • View blog
  • Posts: 1,718
  • Joined: 07-February 14

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 08:51 PM

Except for all the helpful information I did state, but you lack so much understanding that you can't see that as information. When a persons asks a question that overloads the amount of explanation I would need to answer it I do get pissed off, and tell them to go read.
I was also self taught, never asked what a class was.
Was This Post Helpful? 0
  • +
  • -

#21 secondmode   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-March 14

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 11:22 PM

#define You've been a great help so far. I am getting this slowly but surely. I am now stuck on the following:
What does int int numberOfbooksSeenthusfar; represent or defined as?

Also, when would and which methods would the following be used in?

string theAuthor;
string theTitle;
int theNumberCheckedOut;

Thank you so much as always
Was This Post Helpful? 0
  • +
  • -

#22 #define   User is offline

  • Cannot compute!
  • member icon

Reputation: 1868
  • View blog
  • Posts: 6,763
  • Joined: 19-February 09

Re: Really need help building this check in and out library and book class

Posted 11 March 2014 - 11:56 PM

View Postsecondmode, on 12 March 2014 - 06:22 AM, said:

What does int numberOfbooksSeenthusfar represent or defined as?


That is not clear it could be :-
1) total number of times there has been a check out
2) number of individual/unique titles that have been checked out

I suspect it is 2, if not could always be modified.


Quote

Also, when would and which methods would the following be used in?

string theAuthor;
string theTitle;
int theNumberCheckedOut;

Thank you so much as always


In the constructor methods of the class you will need to set the data, as a whole, to a logical and consistent state. The string defaults variables to empty strings, but could be set to empty, if you want, for clarity/peace of mind. The integer type theNumberCheckedOut will need to be initialized to 0.

Of course you or a user will need to access the data so, for example, a getAuthor function will access theAuthor variable.


C++ Language
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2