GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Feb-2006, 03:57
mrdell_06 mrdell_06 is offline
New Member
 
Join Date: Feb 2006
Posts: 4
mrdell_06 is an unknown quantity at this point
Thumbs up

help me to do this program!!!


to all guys out there, please help me to do this program!!!

Write a program to keep book information such as author, publisher, ISBN no., price, year of published and number of pages. Using class within class concept, implement the program in C++ so that for a particular of book, we can list details of the publisher together with the other information.

(Note: You are required to implement this program using class within class.)


Thanks a lot!!!!!
  #2  
Old 21-Feb-2006, 07:06
davis
 
Posts: n/a

Re: help me to do this program!!!


Quote:
Originally Posted by mrdell_06
to all guys out there, please help me to do this program!!!

Write a program to keep book information such as author, publisher, ISBN no., price, year of published and number of pages. Using class within class concept, implement the program in C++ so that for a particular of book, we can list details of the publisher together with the other information.

(Note: You are required to implement this program using class within class.)


Thanks a lot!!!!!


First, go back and READ the guidelines for posting help questions. Second, does "class within class" mean composition or nested classes?

Here is a hypothetical "Book.h" definition based on composition:

CPP / C++ / C Code:
#ifndef _Book_h_
#define _Book_h_

#include <string>
#include <vector>
#include <fstream>
#include <exception>
#include< stdexcept>

// forward declarations
class Publisher;
class Author;
class Date;

typedef std::vector<class Author> vAuthors;
typedef std::vector<class Date> vHistory;

class Book
{
public:
    enum BindingTypes { HARDCOVER=0, SOFTCOVER=1};

    Book();
    Book( const int nPages, 
          const int bindingType, 
          const std::string& isbn, 
          const float height, 
          const float length, 
          const float thickness,
          const int edition,
          const Date& datePublished, 
          const Author& author, 
          const Publisher& publisher, 
          const bool bIsFiction=false );
    Book( const Book& rhs );
    virtual ~Book();

    Book& operator=( const Book& rhs );
    bool operator==( const Book& rhs );
    bool operator!=( const Book& rhs );

    friend ostream& operator<<( ostream& os, const Book& book );
    friend istream& operator>>( istream& is, Book& book );

    const std::string& toString();

    void addAuthor( const Author& author );
    void removeAuthor( const Author& author );
    const std::string& tellAuthors();

    const Publisher& getPublisher() const;
    void setPublisher( const Publisher& publisher );
    const std::string& tellPublisher();

    const Date& getPublishedDate() const;
    void setPublishedDate( const Date& date );

    void addRevisionDate( const Date& date, const int revision );
    void addRevisionDate( const int revision ); // Date == now
    void removeRevisionDate( const Date& date );
    void removeRevisionDate( const int revision );
    const std::string& getRevisionHistory();
    
    const int getPageCount() const;
    void setPageCount( const int nPages );
    const int getBindingType() const;
    void setBindingType( const int type );
    const std::string& getISBN() const;
    void setISBN( const std::string& isbn );
    const float getHeight() const;
    void setHeight( const float height );
    const float getLength() const;
    void setLength( const float length );
    const float getThickness() const;
    void setThickness( const float thickness );
    const int getEdition() const;
    void setEdition( const int edition );

protected:
    vAuthors    m_authors;
    int         m_nPages;           
    int         m_bindingType;      
    std::string m_isbn;    
    float       m_height;         
    float       m_length;         
    float       m_thickness;
    int         m_edition;
    Date&       m_datePublished;  
    Author&     m_author;       
    Publisher*  m_pPublisher; 
    bool        m_bIsFiction; 

private:

};

#endif // ! _Book_h_


I suppose that if you implement the classes shown that you'll get fairly close to what it sounds as if you're asking. Note that this is nothing more than a quick throw-together of a header and none of it is tested for accuracy...and obviously can not be compiled without an implementation of the classes it references.


:davis:
  #3  
Old 21-Feb-2006, 20:20
mrdell_06 mrdell_06 is offline
New Member
 
Join Date: Feb 2006
Posts: 4
mrdell_06 is an unknown quantity at this point

Re: help me to do this program!!!


thanks davis!!!! i really appreciate your kindness
  #4  
Old 21-Feb-2006, 21:12
machinated machinated is offline
Regular Member
 
Join Date: Mar 2004
Location: victoria, canada
Posts: 324
machinated has a spectacular aura aboutmachinated has a spectacular aura about

Re: help me to do this program!!!


if you are in a university, you should realize that profs may check your work with plagiarism detection software. I'm not trying to discourage any helping out, but just advice to keep in mind when you hand in your work. you don't want to get in trouble just for receiving a little bit of help.
__________________
spasms!!!
 
 

Recent GIDBlogHalfway done! by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a file in [c] i hate c C Programming Language 15 21-Nov-2005 12:52
Type casts ? kai85 C++ Forum 12 23-Jun-2005 12:04
[TUTORIAL] Calling an external program in C (Linux) dsmith C Programming Language 4 22-Apr-2005 13:30
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 07:10
Need help with a C program (Long) McFury C Programming Language 3 29-Apr-2004 20:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:26.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.