1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gladu [14]
3 years ago
11

Create a class called Date that includes three pieces of information as instance variables—a month (type int), a day (type int),

and a year (type int). Your class should have a constructor that initializes the three instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day, and year separated by forward slashes (/). Write a test application named DateTest that demonstrates class Date’s capabilities
Computers and Technology
1 answer:
Strike441 [17]3 years ago
3 0

Answer:

public class Date {

   private int month;

   private int day;

   private int year;

   // Constructor

   public Date(int month, int day, int year) {

       this.month = month;

       this.day = day;

       this.year = year;

   }

   //Getters and setter

   public int getMonth() {

       return month;

   }

   public void setMonth(int month) {

       this.month = month;

   }

   public int getDay() {

       return day;

   }

   public void setDay(int day) {

       this.day = day;

   }

   public int getYear() {

       return year;

   }

   public void setYear(int year) {

       this.year = year;

   }

   void displayDate(){

       System.out.println(getMonth()+"/"+getDay()+"/"+getYear());

   }

}

//Test Class

class DateTest {

   public static void main(String[] args) {

       Date dateOne = new Date(12, 25, 2019);

       dateOne.displayDate();

   }

}

Explanation:

  • Using Java programming Language
  • Create the Date class with the instance variables (Month, day and year) all of type int
  • Create the the constructor to initialize all the instance variables
  • Create getters and setters for all the instance variables
  • Create the displayDate() method which uses string concatenation along with the get() method of all the instance variables
  • Create a test class that initializes an instance of the of the Date class
  • Call the method displayDate on the instance of the class created

You might be interested in
What is the intranet?
Verdich [7]
The internet links you to websites that you need.
8 0
3 years ago
What units can be used to express density?
Sav [38]

Answer: Density is the mass of an object divided by its volume. Density often has units of grams per cubic centimeter (g/cm3). Remember, grams is a mass and cubic centimeters is a volume (the same volume as 1 milliliter).

Explanation:

8 0
3 years ago
Write a javascript class called theclass that contains a method called thealert that pops up an alert saying "boo"
Korolek [52]
This can't be answered
8 0
4 years ago
The three takeoffs and landings that are required to act as pilot in command at night must be done during the time period from__
mylen [45]

Answer:

1 hour after sunset to 1 hour before sunrise.

Explanation:

The three departures and arrivals that are required to go about as pilot in direction around evening time must be finished during the timeframe from 1 hour after nightfall to 1 hour before dawn.

To go about as pilot in order of an airplane conveying travelers, the pilot probably made three departures and three arrivals inside the previous 90 days in an airplane of a similar classification, class, and type, if a sort rating is required

3 0
3 years ago
MTINGAENL ....
erik [133]

Answer:

Alignment

Explanation:

7 0
4 years ago
Other questions:
  • Compare and contrast assertiveness, arrogance and passivity.
    14·1 answer
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • I need to create a function that returns Pascal's Triangle with n rows, where n is an int argument.
    12·1 answer
  • What is the recommended size for bulleted text?
    5·2 answers
  • discuss the advantages and disadvantages that Excel has in helping navigate databases, big data, and data analytics.
    11·1 answer
  • Explain the role of the network layer and Internet protocol (IP) in order to make internetworking possible.
    8·1 answer
  • Daniel has a list of numbers that are not in any order. He wants to find the order of the numbers with the help of a spreadsheet
    10·1 answer
  • Computers were originally developed to accomplish various tasks in relative isolation, very different from the collaboration and
    14·1 answer
  • How do i open screenshots on school chromebook?
    15·2 answers
  • how would you deploy network connectivity in the 25 classrooms, 12 faculty offices, and the common areas of the building?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!