Imagine a publishing company that markets its works. Create a class publication that stores the title (a string), author (string), pages (int), pulicationDate (string) and price (type float) of a publication. There should be two constructor i.e. default and parameterized. The default Constructor should initialize the data members to 0 or 0.0 or “” if integers, floating point or string respectively. The parameterized constructor should assign user defined values to the data members. The default constructor should be inline while the parameterized constructor should not be inline. There should be an input/get function to input the values to the data members and a Print() to display the contents of the class variables/datamembers. Create two objects of the class named book, and tape. The book should be created with default constructor, while tape with parameterized constructor. Call input/get for book object only. Then call Print() for both the objects to display the contents. Mention mutator and accessor properly. The input/get and Print() should not be inline. They should be defined outside the class.
Imagine a publishing company that markets its works. Create a class publication that stores the title (a string), author (string), pages (int), pulicationDate (string) and price (type float) of a publication. There should be two constructor i.e. default and parameterized. The default Constructor should initialize the data members to 0 or 0.0 or “” if integers, floating point or string respectively. The parameterized constructor should assign user defined values to the data members. The default constructor should be inline while the parameterized constructor should not be inline. There should be an input/get function to input the values to the data members and a Print() to display the contents of the class variables/datamembers.
Create two objects of the class named book, and tape. The book should be created with default constructor, while tape with parameterized constructor. Call input/get for book object only. Then call Print() for both the objects to display the contents. Mention mutator and accessor properly. The input/get and Print() should not be inline. They should be defined outside the class.
Step by step
Solved in 2 steps with 1 images