u didn't specify the language !!
i am just am going to try and use java here
Code:
//we declare our class person here
class person
{
String first_name = new String(); //first name
String middle_name = new String(); //middle name
String last_name = new String(); //last name
// constructor to create the object without inintialization
person()
{
}
//constructor which takes the first name middle name and last name
person(string fname, string mname, string lname)
{
first_name =fname; //sets the first name
middle_name =mname; //sets the middle name
last_name =lname; //sets the lastname
}
public void setfname(string fname)
{
first_name =fname; //sets the first name
}
public void setmname(string mname)
{
middle_name =mname; //sets the midddle name
}
public void setlname(string lname)
{
last_name =lname; //sets the last name
}
//method to check first name
public void fname_check(string chk_firstname)
{
if (chk_firstname.equals(first_name))
{
System.out.println("The first name check : match")
}
else
{
System.out.println("The first name check: mismatch")
}
}
//method to check last name
public void lname_check(string chk_lastname)
{
if (chk_lastname.equals(last_name))
{
System.out.println("The last name check : match")
}
else
{
System.out.println("The last name check: mismatch")
}
}
}
class my class // main class
{
public static void main(string[] args)
{
string s1 = "jhn"
string s2 = "f"
string s3 = "knnedy"
person person1 = new person(s1,s2,s3);
s1 = "john";
person1.setfname(s1); //sets the first name to john
s2 = "Fitzgerald";
person1.setmname(s2); //sets the middle name
s3 = "kennedy";
person1.setfname(s3); //sets the last name
person1.fname_check(s3); //this is true
s2 ="f";
person1.lname_check(s2); // this is false
}
}
// please check the code ... i haven't checked it.. but this is one way of doing it
// and last but not least dont forget to add the import statements at the start

//as xpi0t0s said copying this wont do u good please work on it ...