Data works
$10-30 USD
Pago na entrega
Download the zipped project file [login to view URL] from the Homework Assignments area of Blackboard.
1. Define the public methods for the following class in a file date.h:
// class representing a date
class date
{
private:
int month, day, year;
bool leap; // true if a leap year
void set_leap (); // sets the leap variable for the year
public:
date (); // constructor, creates a base date
// sets a date to the given parameters
date (int m, int d, int y);
void operator++ (); // moves a date forward one day
void print (); // prints the date in readable format
bool new_year (); // true if date is January first
// equality test for two dates
bool equal (date d);
// greater than test for two dates
bool operator> (date d);
// returns a date with largest components of two dates
date operator% (date d);
// friend that returns the greatest of three dates
friend date great3 (date d1, date d2, date d3);
};
• set_leap is a private member function that sets the value of the leap variable correctly for the year (true if it is a leap year, else false). A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is a leap year if it is also divisible by 400.
• date is an overloaded constructor. The no parameter version sets the date to January 1, 1, leap to false. The three parameter version sets the values of the private data variables representing the date equal to the values given by the three parameters. It also properly sets leap to true or false.
• The overloaded operator ++ moves the date ahead one day. It should properly change to the next month and next year when appropriate. If a change is made to a new year, leap should be set correctly.
print displays the date in the following format:
month day, year
month should be displayed as the month name. print should not print any linefeeds.
• new_year returns true if the date is January first (the year does not matter). Else, it should return false.
• equal returns true if the instance date is equal to the parameter date, else it returns false. Thus a sample call might be:
[login to view URL] (your_date)
which would return true if my_date is equal to your_date.
• The overloaded operator > returns true if the first date is greater than the second, else it returns false.
• The overloaded operator % returns a date with the largest component month, day and year for the given two dates. For example, it might include the month from the first and the day from the second.
• great3 is a friend which returns the greatest of three given dates. It should work in cases when some or all of the dates are equal.
There is an application [login to view URL] written for you. Your program should work for all possible situations not just those in the test program. My output for the application is shown here:
d1 is January 1, 1
d2 is March 6, 1984
Number of days from d1 to d2: 724340
d2 is geater than d1 as it should be!
d1 is March 6, 1984
d2 is March 7, 1984
d3 is March 6, 1984
Greatest of of d1, d2 and d3 is March 7, 1984
d4 is May 5, 1942
d5 is January 5, 1942
d6 is August 1, 1970
d4 > d5
d6 > d4
d6 > d5
Greatest of of d4, d5 and d6 is August 1, 1970
d7 is August 28, 1900
d8 is January 2, 1910
January 1, 1901
January 1, 1902
January 1, 1903
January 1, 1904
January 1, 1905
January 1, 1906
January 1, 1907
January 1, 1908
January 1, 1909
January 1, 1910
Number of days from d7 to d8: 3414
d9 is April 17, 1928
d10 is July 6, 1981
d11 is November 10, 1940
The date with largest components from d9 and d10: July 17, 1981
The date with largest components from d10 and d11 November 10, 1981
5 Points Extra Credit: Label every call in the application file with a comment indicating either member function, friend, or overloaded operator.
Place your completed [login to view URL] and date.h files in the Homework 7 Assignment on Blackboard.
ID do Projeto: #6750578
Sobre o projeto
Concedido a:
I study computer science in college. Can get this job done in a few hours.4-5 tops. Study c++ for 8 years now. Look forward to hear from you.
8 freelancers estão ofertando em média $25 nesse trabalho
JAVA and C++ EXPERT here. Very EASY to me. Contact me ASAP. I can do this. Regards, Junaid
Dear i have done a lot of work in it and also currently working on these type of projects. I will deliver you best quality work on time.
Hello! I am experienced in C++ and after reading your project description, I can provide the work you need within a few hours or less. I would be glad to work for you. Please contact me if you are interested. Have a ni Mais
I am a university student and have already coded bits of this code. i need to combine it for this project. I can get it done withing a few hours
hello I am computer science grad student. I have worked on something similar before and can finish this within a day. let me know if you would like me to work on this. cheers