Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

How to get system date in c++

20/10/2021 Client: muhammad11 Deadline: 2 Day

Assignment 1- Date class

Necessary skills: Basic class design, constructors and member functions, basic iostream output formatting

Description

In this assignment, you'll create a C++ Date class that stores a calendar date.. You'll test it using the supplied test main() function (attached below).

In your class, use three private integer data member variables to represent the date (month, day, and year).

Supply the following public member functions in your class.

A default constructor (taking no arguments) that initializes the Date object to Jan 1, 2000.

A constructor taking three arguments (month, day, year) that initializes the Date object to the parameter values.

It sets the Date's year to 1900 if the year parameter is less than 1900

It sets the Date's month to 1 if the month parameter is outside the range of 1 to 12.

It sets the Date's day to 1 if the day parameter is outside the range of days for the specific month. Assume February always has 28 days for this test.

A getDay member function that returns the Date's day value.

A getMonth member function that returns the Date's month value.

A getYear member function that returns the Date's year value.

A getMonthName member function that returns the name of the month for the Date's month (e.g. if the Date represents 2/14/2000, it returns "February"). You can return a const char* or a std::string object from this function.

A print member function that prints the date in the numeric form MM/DD/YYYY to cout (e.g. 02/14/2000). Month and day must be two digits with leading zeros as needed.

A printLong member function that prints the date with the month's name in the form dd month yyyy (e.g. 14 February 2000) to cout. This member function should call the getMonthName() member function to get the name. No leading zeroes required for the day.

The class data members should be set to correct values by the constructor methods so the get and print member functions simply return or print the data member values. The constructor methods must validate their parameter values (eg. verify the month parameter is within the range of 1 to 12) and only set the Date data members to represent a valid date, thus ensuring the Date object's data members (i.e. its state) always represent a valid date.

The print member function should output the date in the format MM/DD/YYYY with leading zeros as needed, using the C++ IOStreams cout object. To get formatting to work with C++ IOStreams (cout), look at the setw() and setfill() manipulator descriptions, or the width() and fill() functions in the chapter on the C++ I/O System.

#include
#include
#include
using namespace std; // or use individual directives, e.g. using std::string;

class Date
{

// methods and data necessary

};

Use separate files for the Date class definition (in Date.h), implementation of the member functions (Date.cpp), and the attached test main() function (DateDemo.cpp). The shortest member functions (like getDay() ) may be implemented in the class definition (so they will be inlined). Other member functions should be implemented in the Date.cpp file. Both Date.cpp and DateDemo.cpp will need to #include the Date.h file (since they both need the Date class definition in order to compile) and other include files that are needed (e.g. iostream, string, etc).

Sample code and output

// DateDemo.cpp
// Note - you may need to change the definition of the main function to
// be consistent with what your C++ compiler expects.
int main()
{
Date d1; // default ctor
Date d2(7, 4, 1976); // July 4'th 1976
Date d3(0, 15, 1880);// Adjusted by ctor to January 15'th 1900

d1.print(); // prints 01/01/2000
d1.printLong(); // prints 1 January 2000
cout << endl;

d2.print(); // prints 07/04/1976
d2.printLong(); // prints 4 July 1976
cout << endl;

d3.print(); // prints 01/15/1900
d3.printLong(); // prints 15 January 1900
cout << endl;

cout << "object d2's day is " << d2.getDay() << endl;
cout << "object d2's month is " << d2.getMonth() << " which is " << d2.getMonthName() << endl;
cout << "object d2's year is " << d2.getYear() << endl;
}

main() test code

Use the attached DateDemo.cpp source file to test your class.

Save this source as a separate DateDemo.cpp source file that contains the supplied main() function. Compile your Data.cpp file first, then this DateDemo.cpp next.

Here is the attached DateDemo.cpp code

// DateDemo.cpp

#include
#include
#include
using std::cout;
using std::endl;
using std::setfill;
using std::setw;
using std::string;

#include "Date.h"

// note - you may need to change the definition of the main function to
// be consistent with what your C++ compiler expects.

//int _tmain(int argc, _TCHAR* argv[])
int main()
{
Date d1; // default ctor
Date d2(7, 4, 1976); // July 4'th 1976
Date d3(0, 15, 1880);// Adjusted by ctor to January 15'th 1900

d1.print(); // prints 01/01/2000
d1.printLong(); // prints 1 January 2000
cout << endl;

d2.print(); // prints 07/04/1976
d2.printLong(); // prints 4 July 1976
cout << endl;

d3.print(); // prints 01/15/1900
d3.printLong(); // prints 15 January 1900
cout << endl;

cout << "object d2's day is " << d2.getDay() << endl;
cout << "object d2's month is " << d2.getMonth() << " which is " << d2.getMonthName() << endl;
cout << "object d2's year is " << d2.getYear() << endl;

return 0;
}

Read more: http://www.justanswer.com/homework/9b4bk-wondering-answer-assignment.html#ixzz3mY2P5vQW

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Phd Writer
Maths Master
Top Academic Tutor
Buy Coursework Help
Unique Academic Solutions
Homework Master
Writer Writer Name Offer Chat
Phd Writer

ONLINE

Phd Writer

I have read your project description carefully and you will get plagiarism free writing according to your requirements. Thank You

$27 Chat With Writer
Maths Master

ONLINE

Maths Master

I am an academic and research writer with having an MBA degree in business and finance. I have written many business reports on several topics and am well aware of all academic referencing styles.

$34 Chat With Writer
Top Academic Tutor

ONLINE

Top Academic Tutor

Being a Ph.D. in the Business field, I have been doing academic writing for the past 7 years and have a good command over writing research papers, essay, dissertations and all kinds of academic writing and proofreading.

$46 Chat With Writer
Buy Coursework Help

ONLINE

Buy Coursework Help

I am a professional and experienced writer and I have written research reports, proposals, essays, thesis and dissertations on a variety of topics.

$48 Chat With Writer
Unique Academic Solutions

ONLINE

Unique Academic Solutions

I have read your project details and I can provide you QUALITY WORK within your given timeline and budget.

$26 Chat With Writer
Homework Master

ONLINE

Homework Master

I find your project quite stimulating and related to my profession. I can surely contribute you with your project.

$21 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Header file for class c++ - Fe2o3 c balanced equation - Annabel lee literary devices - Racv emergency home assist contact number - Https www youtube com watch v yr5cjyokvus - Firetrol fire pump controller password - 150-300 words prison warden united states - Recycling notice to tenants - 640d6.1 - Silver nitrate and copper experiment - 5 r's of note taking - Ucs c220 m6 spec sheet - Fluharty 2 scoring manual pdf - Ethica and Legal Aspects of Nursing Practice week 7 DQ 11 - Industry terminology examples in aged care - Fair n lovely new ad - Business combination valuation reserve account - Trig cheat sheet calculus - Find a basis for the kernel of the linear transformation - Smart meter emergency credit - Model Evaluation Exercise - Is earth overpopulated bbc documentary - Assignment - Leaf rubbing lesson plan - Admission essay - Convatec orahesive protective powder - Cameron demille's honing powder - Colchester and district sunday league - Drill size for 3/8 unc tap - EP Project - J jj j kk - Outliers in data set independent practice worksheet - Target customer of milk tea - Journalize the april transactions using a periodic inventory system - 12 evergreen drive branyan - Sociological imagination and homelessness - MATH - Inverse laplace transform of s - Life in the Turbulent 1600s - Woolworths annual report 2017 pdf - Nintendo wii case study strategic management - Two important situational contingencies in the path goal theory are - Mcconnell brue flynn microeconomics 19e answers - History of California-4 - Community Corrections - Professional Contribution Comments/Replies - Under armour resources capabilities and core competencies - Al cuso4 al2 so4 3 cu - 0.75 hp electric motor - Five faces of oppression - Corwin corporation case study - The boy without a flag summary - How to win erpsim game - Anti lock braking system diagram - Two quality control technicians measure the surface finish - 7 pool table room size - 5e lesson plan template pdf - Consider a profit maximizing firm in a competitive industry - Health Policy Analysis (pick one) - Prepare a retained earnings statement for marsh corporation - MG401 Unit 4 Discussion - Https www nrdc org stories global warming 101 - DISCUSSION REPLY - Our lady of the visitation primary school - Stoichiometry and percent yield lab report - Ebit eps indifference point calculator - Hyperlipidemia nursing diagnosis care plan - Fact finding techniques pdf - Oh no here we go africano on a roll - Queensland building and construction commission act 1991 - Http www myfitnesspal com tools bmr calculator - Questions to ask a discourse community - Kabihasnang minoan at mycenaean - David schanzer wikipedia - Historical Analysis and Analysis of Relevant Criminological Theories - Q - Solution to mat 144 mission trip assignment details - 3 2 kg in pounds - Topic: How the new vision will affect Job Performance and Job Commitment - Goodnight mr tom crossword answers - Pink puffer vs blue bloater - My Novel: The Hunger Games (Hunger Games Trilogy, Book 1) Special Edition - They say i say author - Direct shipper na tnt com - Slp 3 537 - Mike dilkes laser tonsillectomy - For the record shi and mayer - Minnesota micromotors simulation analysis - Involuntary manslaughter problem question answer - Tae40116 cheat sheet - Therapy with Older Adults - Visual comfort lighting australia - No plagiarism/ must be original/ scholarly resources 2015 - Swanson and associates presently leases a copy machine - Physical or behavioral signs of incipient puberty - Norman browning baton rouge - Reade park lawn tennis club - English 4 1.10 - Estimate the pka of the weak acid - Modify the po q4 worksheet so gridlines will print