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

I need help with the following problem. It is being programmed in Java at a very

ID: 3762516 • Letter: I

Question

I need help with the following problem. It is being programmed in Java at a very basic level. the following are the min. requirements. 1. MyClone accessors and mutators: You will demonstrate your understanding of encapsulation by creating accessor and mutator methods for all instance variables of the MyClone class. 2. MyClone constructor: You should have at least one constructor created that initializes all instance variables. 3. MyClone method introduction(): Create an introduction() method for your MyClone class. The introduction() method will introduce you to the virtual world by displaying a greeting, your first and last name, and anything else you would want to say. 4. Constructor: You will implement at least one constructor that initializes all instance variables. Document your code.

Explanation / Answer

public class MyClone {

private static String firstName;

private static String lastName;

  

   public MyClone(String f, String l) {

       firstName=f;

       lastName=l;

   }

   public static String getFirstName() {

       return firstName;

   }

   public void setFirstName(String firstName) {

       this.firstName = firstName;

   }

   public static String getLastName() {

       return lastName;

   }

   public void setLastName(String lastName) {

       this.lastName = lastName;

   }

  

   public static void introduction() {

       System.out.println("Hello human!!!");

       System.out.println("My name is: "+firstName+" "+lastName);

   }

  

   public static void main(String[] args) {

       MyClone m = new MyClone("einstein", "chegg");

       m.introduction();

   }

}