Created
April 28, 2014 14:05
-
-
Save JorgeOlvera/11373152 to your computer and use it in GitHub Desktop.
Date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class date | |
public static void main(String [] args){ | |
Scanner input = new Scanner(System.in); | |
Date defaultDate = new Date(); | |
Date ourDate = new Data(26, 3, 2014); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateApp{ | |
//Instance variables | |
public int day; | |
public int month; | |
public int year; | |
//Constructors | |
// 1st. Constructor without parameters | |
// Starts on 1/1/1890 | |
public Date(){ | |
day = 1; | |
month = 1; | |
year = 1890; | |
} | |
//2nd. Constructor with parameters | |
//Receives 3 params, all instance variables | |
public Date(int day, int month, int year){ | |
this.day = day; | |
this.month = month; | |
this.year = year; | |
} | |
//Getters & Setters for each instance variable | |
public int getDay(){ | |
return this.day; | |
} | |
public int setDay(){ | |
return this.day; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment