Data structure & Algrothium java program Create the following classes: 1. Name.java object class containing two strings attributes first name and last name (and appropriate constructors,...


Data structure & Algrothium java program


Create the following classes:


1. Name.java object class containing two strings attributes first name and last name (and appropriate constructors, setters/getters)
2. NicePerson.java object class containing the name object and an ArrayList of string to store the list gifts ( and appropriate constructors, setters/getters). This class would extend the attached NicePersonInterface.java
3. Santa.java object class containing one ArrayList of Names to store the naughty names. Another ArrayList of NicePerson to store the nice names and gifts. Add atleast 4 names in each list and display all information.


import java.util.List;<br>import java.util.ArrayList;<br>/**<br>This interface describes the operations of a person on the nice list.<br>@author Frank M. Carrano<br>@author Timothy M. Henry<br>@version 5.0<br>*/<br>public interface NicePersonInterface<br>{<br>// We want the constructor to set the person's name,<br>// but we do not want the client to be able to change it.<br>// So we are omitting a method setName.<br>/** Gets the name of this person.<br>@return<br>The name of a person on the nice list. */<br>public Name getName ( );<br>/** Adds a gift to this person's gift list.<br>@param aPresent<br>@return<br>A string that describes the gift.<br>True if the gift was added, or false if not. */<br>public boolean addGift(String aGift);<br>/** Removes a gift from this person's gift list.<br>@param aGift<br>@return<br>public boolean removeGift(String aGift);<br>A string that describes the gift.<br>True if the gift was removed, or false if not. */<br>/** Sets this person's gift list.<br>@param aGift<br>public void setGifts (ArrayList<String> gifts);<br>A string that describes the gift. */<br>/** Gets this person 's gift list.<br>@return<br>This person's gift list. */<br>public ArrayList<String> getGifts();<br>// end NicePersonInterface<br>

Extracted text: import java.util.List; import java.util.ArrayList; /** This interface describes the operations of a person on the nice list. @author Frank M. Carrano @author Timothy M. Henry @version 5.0 */ public interface NicePersonInterface { // We want the constructor to set the person's name, // but we do not want the client to be able to change it. // So we are omitting a method setName. /** Gets the name of this person. @return The name of a person on the nice list. */ public Name getName ( ); /** Adds a gift to this person's gift list. @param aPresent @return A string that describes the gift. True if the gift was added, or false if not. */ public boolean addGift(String aGift); /** Removes a gift from this person's gift list. @param aGift @return public boolean removeGift(String aGift); A string that describes the gift. True if the gift was removed, or false if not. */ /** Sets this person's gift list. @param aGift public void setGifts (ArrayList gifts); A string that describes the gift. */ /** Gets this person 's gift list. @return This person's gift list. */ public ArrayList getGifts(); // end NicePersonInterface
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here