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

  Write a function named digit_name

Write a function named "digit_name" that takes an integer argument in the range from 1 to 9 , inclusive, and prints the English name for that integer on the computer screen.

  Have to write a small program that prompts the user to

have to write a small program that prompts the user to enter a temperature in degrees fahrenheit and then prints a

  C program to calculate power loss in transmission line

Write program in C to calculate the power loss in transmission line with resistance of 0.05 ohms/mile. Calculate power loss if 500 kW of power is transmitted from power generation station

  Potential classes to be implemented in the future

Discuss any potential classes to be implemented in the future

  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..

  Why should stream operators be overloaded as friend function

Why should the stream operators and >> be overloaded as friend functions? Why should the arithmetic operators +, -, *, and / be overloaded as friend functions?

  Write a c function called bspline

Write a C function called Bspline that takes as input a single double precision argument called x. The function returns a double precision value y determined as given

  The rpn calculator program

The RPN calculator program should read the RPN expression as an entire line from stdin.Input will consist of a single line. After completing the evaluation of the expression, the program should print the contents of the entire stack, starting with th..

  How many times would you like to shuffle the sorted list

You are required to implement your designs in C++ Programming Language. Your program should be properly laid out and should be modular, making sure that software engineering aspects of modularity and reusability are fully considered.

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Calculate the commission owing for that record

Construct an algorithm that will read a record on the file, calculate the commission owing for that record, and print the retail price, commission and employee number

  Write a program that reads an infix or postfix expression

Write a program that reads an infix or postfix expression from an input file, evaluates the expression and outputs the result.

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