Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Student class with the following: A private String variable named “fNam

ID: 3634802 • Letter: C

Question

Create a Student class with the following:

A private String variable named “fName” to store the student’s first name
A private String variable named “mName” to store the student’s middle name
A private String variable named “lName” to store the student’s last name
A private String variable named “UFID” that contains the unique ID number for this student
A private String variable named “DOB” to store the student’s date of birth
A public constructor Student() which will set default names, IDs and DOB:
Several public set methods:
SetNames(String name) will store the first word in name to fName, last word to lName, and if the name contains a middle name, store in mName. (Note: it is possible that the input String has just two words, but never 4 or more words.)
SetUFID(String id) will check whether id is a valid UFID in the format of xxxx-xxxx where x is a single digit. If so, it will set UFID accordingly. Otherwise, give a message and do not change the UFID.
SetDOB(String dob) will check whether the input String is in the format of MM/DD/YYYY and also with valid date. E.g., 02/30/1999 is not a valid date since February does not have 30 days, while Feb 12, 1999 is not a valid format. You should allow user to input date without unnecessary 0 in it, e.g., 2/3/1999 is valid.
A set of Get methods to retrieve the name/UFID/DOB info.
A public method toString() returns a String in the following format:
Name: Last name, first name
UFID: xxxx-xxxx
D.O.B: MM/DD/YYYY

Explanation / Answer

Hope this helps, please rate! public class Student { public String fName; public String mName; public String lName; public String DOB; public String UFID; public Student(){ fName = "Tim"; lName = "Tebow"; DOB = "09/12/2000"; UFID = "0129-1289"; } public void setNames(String name){ String[] list = name.split(" "); if(list.length == 2){ fName = list[0]; lName = list[1]; } else if(list.length == 3){ fName = list[0]; mName = list[1]; lName = list[2]; } if(list.length>3){ fName = "Two many words in name"; mName = ""; lName = ""; } } public String getName(){ if(mName == ""){ return lName + ", " + fName; } else return lName +", " + fName + " " + mName; } public void setUFID(String id){ if(id.matches("[0-9]\d{3}-[0-9]\d{3}")){ UFID = id; } else UFID = "Invalid ID"; } public String getID(){ return UFID; } public void setDOB(String dob){ String[]date = dob.split("/"); if(date[0].length()