EBK JAVA HOW TO PROGRAM, LATE OBJECTS
EBK JAVA HOW TO PROGRAM, LATE OBJECTS
11th Edition
ISBN: 9780134763507
Author: Deitel
Publisher: VST
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
Roll no. 021 Java language Give solution
#pyhton programing topic: Introduction to Method and Designing class Method overloading & Constructor overloading   ------------------ please find the attached image
State whether it is true or false and why .

Chapter 3 Solutions

EBK JAVA HOW TO PROGRAM, LATE OBJECTS

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT