Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
11th Edition
ISBN: 9780134743356
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 3, Problem 10.1E
Program Plan Intro

Date Class

Program Plan:

  • Define a class called Date.
  • Declare three private variables of type int to hold month, day and year.
  • Define a default constructor that sets the instance variables to the default values.
  • Define a constructor to initialize the class variables with parameter values.
  • Define set and get methods for each instance variables.
  • Define a method called displayDate() to display the date in the form of month/day/year.
  • Define a class called DateTest.
  • Define the main method.
  • Define a Date object by using parameterized constructor.
  • Call the displayDate() method by using Date object to display the date.
  • Define another Date object by using default constructor.
  • Prompt the user for month, day and year.
  • By using the set methods, set the month, day and year for the object.
  • By using get methods, display the month, day and year values in different formats.
  • Call the displayDate() method by using Date object to display the date.

Blurred answer
Students have asked these similar questions
What is method overloading? Is it permissible to define two methods that have the same name but different parameter types? Is it permissible to define two methods in a class that have identical method names and parameter lists, but different return value types or different modifiers?
Finish code with same class name and method names
All needed parameters must be passed in during method call.

Chapter 3 Solutions

Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education