I'm supposed to write a code in two different classes, and create different constructors of members with information on their date of birth, name, gender, etc, which are all user inputted. Problem is, an example asks for it to be written like this:
Input the team members (Name:Surname:Sex:DD/MM/YYYY):
But as this will come out a string, how am I supposed to change some of these into integers when recording different dates of birth, etc? As my current constructer is :
public Member(String name, String surname, int date, int month, int year, char sex){
How can I differentiate the String inputted, from name, date, year, etc?
public class Member {
private String name;
private String surname;
private int date;
private int month;
private int year;
private char sex;
public Member(String name, String surname, int date, int month, int year, char sex){
this.name = name;
this.surname = surname;
this.date = date;
this.month = month;
this.year = year;
this.sex = sex;
}
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public int getDate() {
return date;
}
public int getMonth() {
return month;
}
public int getYear() {
return year;
}
public char getSex() {
return sex;
}
}
Other class runs on these methods. I haven't developed the other one yet.