Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have made an attempt at the program but am super confused and would like to see how to do it with a fully explained

I have made an attempt at the program but am super confused and would like to see how to do it with a fully explained code I really appreciate the help : ) thank you in C++ please

For each class create an *.h and *.cpp file that contains the class definition and the member functions. There will also be one file called 'main.cpp' that contains the main() function, and will instantiate the objects and test them.

Create 2 new classes for this project, one will be a 'Book' class and one will be a 'Date' class

Take the song class. Add the project new files called Book.h and Book.cpp and create the new class from scratch in those files. Use the 3 most important data members that describe the class/object to build (Title, Author, Pages ) and the write 2 constructors, 3 get member functions, 3 set member functions and a toString method and that is all.

Once you have created a new class, you need to adjust the main() function to allow the user to input the data members for your class and create an object of that type. Use the toString method to then display the new object on the screen. When the project is complete, both classes/objects should be created and displayed with main().

Please do not use the same 3 data types for any class's member variables. That is, do not make them all ' int ' or all ' string '.

Date class, the data members will be int day; int year; string month; Create a Date class with 2 constructors, 3 get member functions, 3 set member functions and a toString method. Adjust the main() function to use the Date class. When the user wants to build a Date object, on the screen input 3 values, one for each member variable. Insert values into the Date object then output a simple message like:

"The Date object is: March 2, 2013"

It is very important that the data input be inserted INTO the object, and pulled back OUT of the object to print the above message.

Write a method: int getMonthNumber(); that returns the proper value 1-12 based on the string stored in the month variable. It should return the value -1 if the current value in the month variable is NOT valid. DO NOT store the month number in a member variable (local is OK), generate it when the method is called.

Write a method: void printDate( int format ); when it is called the format value will determine how the date is output to the screen using cout:

format 0: Mar 12, 2013 format 1: 12 Mar 2013 format 2: 3-12-2013 format 3: 3/12/13

Of course the actual values stored in the object will be output, this is only an example. Modify the main program to print the date in these additional formats. Optional: Use the int getMonthNumber(); method to check if the user enters a proper value for the month variable.

_____ Three global variables (not the same type)

_____ Two constructor methods

_____ Three 'get' methods

_____ Three 'set' methods

_____ One 'toString' method

_____ In the main function you create an object, insert values into the object, and print the object

_____ Five total classes Book.cpp, Book.h, Date.cpp, Date.h and a main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

3. Did you seek anyones advice?

Answered: 1 week ago

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago