Consider the following detailed inheritance hierarchy diagram: (ATTACHED IN IMAGE) The person constructor has two string parameters, a first name, and the last name. The constructor initializes the...


Consider the following detailed inheritance hierarchy diagram:


(ATTACHED IN IMAGE)



The person constructor has two string parameters, a first name, and the last name. The constructor initializes the e-mail address to the first letter of the first name followed by the first five letters of the last name followed by @jc.com. If the last name has fewer than five letters, the e-mail address will be the first letter of the first name followed by the entire late name followed by @jc.com


Implement the person constructor:


Inheritance and Polymorphism<br>Free Response Questions:<br>Consider the following detailed inheritance hierarchy diagram<br>Person<br>instance variables<br>private String myFirstName<br>private String myLastName<br>private String myEmailAddress<br>methods<br>public String getFirstName()<br>public String getLastName( )<br>public String getEmailAddress( )<br>public abstract int compareTo(Person p);<br>Student<br>class variables<br>int lastIdAssigned // initially set to 20050<br>instance variables<br>private int myStudentId<br>private double myGpa<br>private double myNumberOfCredits<br>methods<br>public void addCourse(int credits, double grade)<br>public int getStudentId( )<br>public double getGpa( )<br>(a)<br>The Person constructor has<br>two String parameters,<br>a first name and a last<br>name.<br>The constructor initializes the e-mail address to the first letter<br>of the<br>followed by @jc.com.<br>e-mail address will be the first letter of the first name followed by the<br>entire last name followed by @jc.com.<br>first name<br>followed by the first five letters of the last name<br>If the last name has fewer than five letters, the<br>Examples:<br>Name<br>Email Address<br>JSmith@jc.com<br>JMorri@jc.com<br>MKey@jc.com<br>Jane Smith<br>John Morris<br>Mary Key<br>Implement the Person constructor.<br>

Extracted text: Inheritance and Polymorphism Free Response Questions: Consider the following detailed inheritance hierarchy diagram Person instance variables private String myFirstName private String myLastName private String myEmailAddress methods public String getFirstName() public String getLastName( ) public String getEmailAddress( ) public abstract int compareTo(Person p); Student class variables int lastIdAssigned // initially set to 20050 instance variables private int myStudentId private double myGpa private double myNumberOfCredits methods public void addCourse(int credits, double grade) public int getStudentId( ) public double getGpa( ) (a) The Person constructor has two String parameters, a first name and a last name. The constructor initializes the e-mail address to the first letter of the followed by @jc.com. e-mail address will be the first letter of the first name followed by the entire last name followed by @jc.com. first name followed by the first five letters of the last name If the last name has fewer than five letters, the Examples: Name Email Address [email protected] [email protected] [email protected] Jane Smith John Morris Mary Key Implement the Person constructor.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here