C++ OOP Assignment

Write C++ instructions that declare the following pointers: 

1) a is a pointer to a pointer to a char

2) b is an array of 3 char pointers 

3) c is a pointer to an array of 30 chars 


#   Create an implementation of a class called Date that uses three member variables—a month (type int), a day (type int) and a year (type int). The implementation should provide the following functionalities:

Two constructors:

I . A default constructor that initializes the date to 1/1/1900. 


II . A constructor that accepts three arguments: a month (type int), a day (type int) and a year (type int) to initialize the object instance. The constructor assumes that the day value should be from 1 to 31, the month from1 to 12 and the year is between 1900 and 2025. 


▪a getMonth, getDay and getYear methods (these are accessor methods). 

▪a setMonth, setDay and setYear methods (these are mutator methods). Each of the three methods takes an integer as an argument and assumes that the value provided fall under the correct range. 

▪a display method that prints to the standard output the month, day and year separated by forward slashes (/). 

▪an equal method that takes another Date object as an argument. The method will return true if the date of the object instance is equal to the Date objects that is sent as an argument, otherwise the method returns false. 


The main()  method should demonstrate the capabilities of the implementation of the Date class. First, main should create a Date instance then should make sure that each member function is working properly.

Need a custom answer at your budget?

This assignment has been answered 5 times in private sessions.

© 2024 Codify Tutor. All rights reserved