public class Date
{
// instance variables
private int day, month, year;
/**
* Constructor for objects of class Date
*/
public Date(int dd, int mm, int yy)
...
Type: Posts; User: javapenguin
public class Date
{
// instance variables
private int day, month, year;
/**
* Constructor for objects of class Date
*/
public Date(int dd, int mm, int yy)
...
In the person copy, yes.
That will copy all the stuff that's current but it won't change if you change the original.
Ahhhh...I see now.
Use dob.getDay(), dob.getYear(), dob.getMonth() for the other ones.
First of all, how are you initializing the Date object dateofbirth?
use this.getName,
or whatever.
Like if you had soemthing that had a constructor
String name, int value, char c;
You don't have a constructor (String value, char value2, String value3) do you?
Oh you might.
Let's see the copy method.
In fact, show all the code.
Oh, I think I might see why it won't just let you pass it as a parameter.
You do need the day, month, and year as parameters for the Person parameters in order to initialize the dateofbirth...
:-?:-?
Does the date of birth have to be passed as a parameter?
If not, you can just do this:
// note, this is an example
private Date dateOfBirth;
public Date(Date other)
{
day = other.day;
month = other.month;
year = other.year;
}
You don't have a method name so it assumes that this thing is a...
Does your Date class have a getDateOfBirth() method?
If so, it can call that to get Date of Birth.
However, I'm not sure how to pass it as parameter to Person class, the Date object that is.
...
Data type?
Make DOB an object of Date?
Have a method getDateOfBirth and setDateOfBirth.
I think that's what they want you to do.
I don't get
That's supposed to be the constructor for the Date class.
static final int JANUARY= 0;
static final int FEBRUARY = 1;
static final int MARCH = 2;
static final int APRIL = 3;
static final int MAY = 4;
static final int JUNE = 5;
static final int JULY =...
Date is mostly deprecated. Calendar works better.
However, wouldn't a String work best?
October 9, 1920
10/09/1920