A class definition for a date class that contains 3 integer

Assignment Help C/C++ Programming
Reference no: EM13939148

1. A class definition for a Date class that contains three integer data members: month, day, and year.

2. One constructor that assigns the date 1/1/2000 to any new object that does not receive any arguments.

3. One constructor that accepts month and day arguments and uses a default year of 2004.

4. One constructor that accepts month, day, and year arguments.

5. Each constructor should also output a message to the user stating which constructor is currently being used.

6. A method that displays the values in the Date object.

7. A Main() program in which you:

a. Instantiate three Date objects - create one for each type of constructor (no argument, 2-argument, 3-argument).

b. For the 2-argument and 3-argument constructor prompt the user for console input of the month, day or month, day, year.

c. Display output for each of the three constructor types.

8. Internal Documentation

Your output should look something like this:

Implementing overloaded constructors program
************************************
Using no-argument constructor, assigning date 1/1/2000
The date in this object is 1/1/2000
************************************
Enter a month eg: 10 for October: 10
Enter a day eg: 24: 24
Using 2-argument constructor, assigning year 2004
The date in this object is 10/24/2004
************************************
Enter a month eg: 10 for October: 8
Enter a day eg: 24: 25
Enter a year eg: 1950: 1951
Using 3-argument constructor, for mo/da/yr
The date in this object is 8/25/1951
************************************
Press any key to continue . . .

A constructor must have the same name as the class. A constructor is automatically called when an object is instantiated. A constructor is the most appropriate place to initialize data members.

Here is an example of declaring a constructor:

public class Date
{
public Date() //no argument constructor
{

...code to initialize variables

}
}

Reference no: EM13939148

Questions Cloud

Gaining a global understanding of the research : The goal of this assignment is to ensure that you have conducted a broad, comprehensive review of the literature so that you may gain a global understanding of the research in your chosen topic area.
Is reality nothing more than a joint social illusion : Why do Americans generally have such a negative and fearful approach to aging? Is this a part of our larger fear of death and dying? How might the emotional needs of dying people be better served in your local community?
Prepare journal entries for all activities relating to labor : Escuchar Products, a producer of DVD players, has established a labor standard for its product-direct labor. Compute the labor rate and efficiency variances. Prepare journal entries for all activities relating to labor.
Describe a scenario for the production and consumption : Describe a scenario for the production and consumption of a product that involves all three sectors of an economy. Explain what each sector contributes to the transactions and what each sector receives. Which sector benefits the most from the transac..
A class definition for a date class that contains 3 integer : A class definition for a Date class that contains three integer data members: month, day, and year.
Investment opportunities for australian businesses : Potential export, import and investment opportunities for Australian businesses in these three countries.
Describe and explain the business costs : Findings and Analysis: describe and explain the business costs you have researched with Harvard references. Show the individual and total costs. Use tables if you wish.
Alienation in the workplace : alienation in the workplace fetishism of commodities exploitation of workers
Define the main biological influences of psychology : Define neurotransmitters and describe their role in neurotransmission. Discuss how they are released, how they affect receiving neurons, and how they are removed from receptor sites.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Design your own test program to test the modification.

Add method Modify(int id, char*, char*, float, char*) to modify the id's record. If such id not exist, add it as a new record into the list

  Compcets of office apps

Cell Reference is the location of a cell. Cells are located in columns marked by letters, and rows are marked by numbers. Example to reference a cell in column D row 10 you would reference it as D10.

  Program reads the contents of employees

Design a program that reads the contents of the employees.dat file and prints all the data within it. Format the report as designated in the Printer Spacing Chart below.

  Write a recursive void function

Write a recursive void function called rot at eLeft that rotates the first n integers in an array to the left. To rotate n items left, rotate the first n - 1 items left recursively, and then exchange the last two items. For example, to rotate the ..

  What is the maximum duration

A computer on a 10Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 2Mbps. It is initially filled to capacity with 16Megabits. What is the maximum duration for which the computer can transmit at the full 10Mbps?

  Implements a cyclic redundancy check algorithm

Write a C++ program that Implements a cyclic redundancy check algorithm in C++: The program should provide a mechanism for inputting a stream of data 128 bytes in length. It should calculate a 32-bit CRC for that data. It should output the data strea..

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

  Prepare a program to print out a multiplication table

Create a program using C++ that prints out a multiplication table up to a specific limit. The code should prompt the user for the limit and then print out the table.

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the attached

  Write a program that takes a positive integer

Write a program that takes a positive integer from the user and prints the rightmost digit of that integer. This is a sample output: Enter an integer: 1247

  What is the current size of q

Suppose an initially-empty queue Q has performed a total of 32 enqueue operations, 10 front operations, and 15 dequeue operations, 5 of which generated QueueEmptyExceptions, which were caught and ignored. What is the current size of Q?

  Implement a append function

Write and test the following function: void append(int a[], int m, int b[], int n); The function appends the first n elements of the array b onto the end of the first m elements of the array a.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd