Question: The code below the pink highlighted is my attempt to the question. This is JAVA. Please provide a answer in JAVA. Encapsulate the Name class.

The code below the pink highlighted is my attempt to the question. This is JAVA. Please provide a answer in JAVA.
Encapsulate the Name class. Modify the existing code shown below to make its fields private, and add appropriate accessor methods to the class named getFirstName, getMiddleInitial, and getLastName Revert Type your solution here: 1// A Name object represents a person's name such as "John Q. PubliC" cannot find symbol: method getMiddlelnitial0 in variable name of type Name 2 public class Name private String firstName; private char middleInitial; private String lastName; 4 7 public Name(String first, char middle, String last) firstName- first; middleInitial middle; lastName - last; 10 12 13 public String getFirstName() 14 15 16 17 18 public String getmiddleInitial() 19 20 21 return first; return middle; public String getlastName () 23 24 25 26 27 return last; This is a class problem. Submit a complete Java class as described. E 4 Indent
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
