The addDays method will add n number of days to the current date that's stored in Object's data. For example, object hol

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

The addDays method will add n number of days to the current date that's stored in Object's data. For example, object hol

Post by answerhappygod »

The addDays method will add n number of days to the current date that's
stored in Object's data. For example, object hold 4/21/2022 as the date and if
user of this object calls addDays (10) method, it will add 10 days to
4/21/2022 giving a new date of 5/1/2022. There can be more complicated
scenarios if you add a lot of days (for example hundreds of days) due to
possible rollover of year and months. You can limit number of days to be
added to 100.
Just like addDays, subtractDays method will subtract number of days from
the current date.
void Date::addDays(int n);
void Date::substractDays(in n);
Provide implementation of both functions in the class. Also modify your
main function as follows:
The Adddays Method Will Add N Number Of Days To The Current Date That S Stored In Object S Data For Example Object Hol 1
The Adddays Method Will Add N Number Of Days To The Current Date That S Stored In Object S Data For Example Object Hol 1 (87.86 KiB) Viewed 12 times
int main() { std::cout << "Hello World!\n"; Date myDate(4, 21, 2022); myDate. showDate(); myDate.addDays(10); myDate. ShowDate(); myDate. subtractDays (9); myDate. showDate(); myDate. addDays (100); myDate. showDate(); myDate. subtractDays (100); myDate. showDate(); return 1;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply