Hi and hope someone can help. I doing some Java lessons (sadly they don't give us model answers until we actually get the whole thing working!) and am currently trying to get multiple constructors to work. I already have a working Person object as follows:-
public class Person {
private String name;
private MyDate birthday; // This is a date based on a Person's birthday
private MyDate today; // A date based on today's date
private int day; // day of birth
private int month; // month of birth
private int year; // year of birth
// private int numDays;
public Person(String name, int pp, int kk, int vv) {
this.name = name;
this.day = pp;
this.month = kk;
this.year = vv;
this.birthday = new MyDate(pp, kk, vv);
}
and now they want us to create shortened versions of these such as these but both are showing errors in NetBeans:-
public Person(String name) {
MyDate today = today(); // Creates a date based on today's date
this.Person(name, today);
}
public Person(String name, MyDate birthday) {
this(name, birthday);
}
Ande here's the MyDate method
public class MyDate {
private int day;
private int month;
private int year;
public MyDate(int pv, int kk, int vv) {
this.day = pv;
this.month = kk;
this.year = vv;
}
Any ideas on how I can get these working? Thanks for your interest.