Java project

Learning Goal: I’m working on a java project and need an explanation and answer to help me learn.

In this assignment, you will update the Weight, Date, YoungHuman, and ArrayList classes from previous homeworks using new ideas that we have discussed in class, and you will create an ChildCohort class extending your ArrayList. Build a driver that will fully test the functionality of your classes and include the driver with your submission.

  1. Fix any privacy (and other) errors that were noted in your comments for the previous iteration of this homework.
  2. Modify the Weight, Date, and YoungHuman class to implement the Comparable interface. Remember that compareTo takes an Object parameter and you should check to make sure that the object that comes in is actually the correct class for the comparison, as appropriate. (How could the CompareTo method be implemented for YoungHuman? If you were sorting a collection of YoungHumans, how would you want them sorted? Make a reasonable choice and document your choice.)
  3. Modify the Weight, Date, and YoungHuman classes to implement the Cloneable interface. Note that Weight and Date can simply copy their private instance variables, since they store only primitive and immutable types. However, you will need to override the clone method, to make it public, since it is protected in the Object class. The YoungHuman class will need to do more, since it incorporates the Weight and Date classes, which are mutable. Note that it can (and should) use the clone methods of those classes. Be sure to remove any use of the copy constructor for Weight, Date, and YoungHuman in the rest of the code (the definition can exist, but don’t use it in other classes; use the clone method instead).
  4. Build a class ChildCohort that extends your ArrayList. (Reminder: you are using YOUR ArrayList, not the built in Java one.) The ChildCohort class is used to keep track of a bunch of children. For example, maybe there is a cohort of kids all born during the same year and they want to keep track of them all and see if they have things in common. You should remove the limit on the number of YoungHumans that can be placed in a cohort by making your ArrayList dynamically resize itself. (You may do this either by resizing an internal array, or by implementing your ArrayList as a linked list. If your ArrayList is implemented as a linked list (for instance, by changing your Quack class into an ArrayList from “Linked Lists, Stacks & Queues” homework), then make sure to include any of these other classes when you turn in this assignment.) The ChildCohort class is essentially an ArrayList of YoungHumans. Your ChildCohort must include AT LEAST one method that you don’t just inherit from the ArrayList class. What should it have? What would be useful for this class to have? That’s for you to answer!
    1. This ChildCohort should ONLY hold YoungHumans. Thus you should also override the insert method (and any add or append methods) to check that what comes in is a YoungHuman object (though it can then just redirect to the parent’s insert method). (If it’s not a YoungHuman object, send a message to the console but then don’t add it.)
  5. Modify Weight, YoungHuman, and Date to implement the Serializable interface.
    1. (See for example: http://tutorials.jenkov.com/java-io/serializable.html (Links to an external site.) and https://www.tutorialspoint.com/java/java_serialization.htm (Links to an external site.) )
    2. Note: you do NOT need to give the class a serialVersionUID, as that first example shows.
  6. Build a driver that will fully test the functionality of all your classes (just to make sure that all these interfaces work) and include the driver with your submission. (You don’t have to test Serializable if you don’t want to.)

Hints, Etc.

  • Remember to follow the Coding Style Guidelines.
  • Make sure you comment all methods and the class with javadoc comments. This includes constructors, getters, setters, etc. If you have files based on code one of the teachers here has written (e.g., is based on a skeleton), you have to javadoc comment the methods someone else wrote also. You cannot receive full-credit for the rubric’s commenting criterion if you do not have a javadoc comment for every method, no matter how small. All methods should have pre- and post-conditions as well.
  • Your code should not depend on absolute path specifications or any other environment-specific specifications. The program should not ask for user input from the console.
  • The description for this assignment is much briefer than in some previous assignments. In particular, not much detail is given regarding what methods to have, etc. It is purposely open-ended. By this point, you should be able to design an appropriate interface to your classes as well as create an appropriate driver filled with tests. My advice is not to scrimp on the interface; include all methods one would reasonably expect objects of that class would be able to do.
  • Classes whose names are given in this assignment description should be given that name. If you submit multiple versions, Canvas will rename your files with a “-1”, etc. suffix, but that’s okay. We can handle that change. But the base name of your class has to be as described.
  • An example of questions to ask when defining an interface (for the ChildCohort class): What kind of data and methods should go into an ChildCohort class? What would you use a ChildCohort for? What would you want to know about a group of children? For instance, you might be interested in knowing child child is oldest or youngest. You might be interested in knowing which child had their check up the longest ago (and so is probably due for one). And so on … these are just two examples of questions you might ask of a group of kids. It depends on the use cases you want the child cohort to satisfy. These kinds of questions can also be asked for YoungHuman, etc.
  • What to turn in:
    • Weight.java
    • Date.java
    • YoungHuman.java
    • ChildCohort.java
    • ArrayList.java
    • any other classes you need to implement the above
    • Driver.java
Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.