hello all.. i have a programming homework for sunday, wish some will help me with this define a class person type to store the name of person and 1: set the first name only 2: set the last name only 3: store and set the middle name 4: check whether a given first name is the same as the first name of this person 5: check whethter a given last name is the sane as the last name of this person write the definitions of the member function to implement the operations for this class. also write a program to test various operations on this class. plz helppppp
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 ...