please help me create the first part of date class project.
Date Class Project (part #1)
Create a class named Date
The class has 3 int variables for month, day, and year (05 points)
The class has a Boolean value for whether the date is a leap year
private int month;
private int day;
private int year;
write the following "set" methods (15 points)
public void setMonth(int m)
public void setDay(int m)
public void setYear(int yyyy) note – year is 4 digits
write the following "get" methods (15 points)
public int getMonth()
public int getDay()
public int getYear()
Write the following methods: (10 points)
1. public boolean isLeapYear()
this method uses the year variable and returns true
if the year is a leap year. Otherwise returns false.
2. public boolean validateDate() 20 points
a. Returns true if the mm, dd, and yyyy (data items)
compose a valid date
b. Returns false if the mm, dd, and yyyy (data items)
do not compose a valid date
3. public void printDate() 10 points
this method prints out your Date variables in the
following format
month xx
day xx
year xxxx and is (is not) a leap year
create a testing program to test your Date object and its methods.
Name the test program TestDate
Upload the Date.java and TestDate files to Date01 assignment for
evaluation if you wish
Date Class Project (part #2)
Add two constructors to your Date class.
public Date(); 10 points
sets day to 1, month to 1, and year to 1900
public Date(int m, int d, int y); 10 points
sets day to d, month to m, and year to y
create a testing program to test your Date object and its methods.
Name the test program TestDate
Upload the Date.java and TestDate files to Date02 assignment for
evaluation if you wish
Date Class Project (part #3)
Add the following data items to your Date class 05 points
1. int dayOfYear
2. String monthName
3. String dayOfWeek
Add the following methods to your Date class 10 points
1. public void calcDayOfWeek()
Computes the day-of-the-week and stores the day of
week String in the dayOfWeek data item.
(depending in the month, day, and year data items)
2. public String getDayOfWeek() 05 points
returns the day-of-the-week
3. public void calcMonthName() 05 points
Finds the month name and stores the String in the
monthName data item.
4. public String getMonthName() 05 points
returns the month name data item
5. public void calcDOY() 20 points
Calculates the Julian day-of-year and stores it
in the dayOfYear data item.
Examples 01/10/2005 is 10 02/10/2005 is 41
03/01/2005 is 60 03/01/2000 is 61
6. public int getDOY() 05 points
returns the day-of-the-week
7. modify the public void printDate() method to include 05 points
the month name, day of week, and the dayOfYear
month xx (month name)
day xx
year xxxx and is (is not) a leap year
day of week xxxxxxxxx
day of year ddd
8. private void adjustData() that calls the methods 15 points
a. calcDayOfWeek()
b. calcMonthName()
c. calcDOY()
add adjustData() to your constructors and “setMethods()”
create a testing program to test your Date object and its methods.
Name the test program TestDate
Upload the Date.java and TestDate files to Date03 assignment for
evaluation if you wish
Date Class Project (part #4)
Add a constructors to your Date class.
public Date(int doy, int y) 20 points
a. sets year to y
b. using the doy, calculates the month and day
c. runs calcDayOfWeek()
d. runs calcMonthName()
add a method
public String getDateSpelledOut() 10 points
that returns a String with the date in the format
mmmmmmmm nn, yyyy day-of-week
Example November 14, 2008 Wednesday
January 1, 2009 Tuesday
create a testing program to test your Date object and its methods.
Name the test program TestDate
Upload the Date.java and TestDate files to Date04 assignment for
evaluation if you wish
/******************************************************************
*
* program name: Date
* author: Capt. Kirk
* date due: 09/15/2006
* remarks: describes a Box object
*
********************************************************************/
class Date
{
public int month; // store the month
public int day; // store the day
public int year; // store the year
/**********************************
* constructors
***********************************/
/**********************************
* set methods (setters)
***********************************/
public void setMonth(int m)
{
month = m;
}
public void setday(int day)
{
day= m;
}
public void setyear(int year);
public void setyear (int year)
{
year = m;
}
/**********************************
* get methods (getters)
***********************************/
public int getMonth() { return month;}
public intgetDay () {return day;}
public intgetYear() {return year;}
/**********************************
* initialize methods
***********************************/
public boolean calcLeapYear()
{
boolean isLeapYear = true;
if(year %400 == 0;)
{isLeapYear = true;}
if(year % 100 == 0;)
{isLeapYear false;}
if (year % 4 == 0;)
{ isLeapYear true;}
else
{isLeapYear false;}
}
}class TestDate
{
public static void main (String args[])
{
Date d1;
d1 = new date();
Date d2 = new Date();
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
d1.setMonth(11);
d1.setDay (11);
d1.setYear(1999);
System.out.println("month is " +d1.getMonth());
System.out.println("day is " +d1.getDay());
System.out.println("year is " +d1.getYear());
}
}