1. Homepage
  2. Programming
  3. CS 5004 Assignment 4: NationalParkDirectory and Set

CS 5004 Assignment 4: NationalParkDirectory and Set

Engage in a Conversation
JavaObject-Oriented DesignCS 5004USNEUNortheastern University

CS 5004, Spring 2023 CourseNana.COM

Assignment 4

Refer to Canvas for assignment due dates for your section. Objectives: ● Implement and test a mutable ADT. ● Implement and test an immutable ADT. CourseNana.COM

General Requirements

Create a new Gradle project for this assignment in your course GitHub repo. Make sure to follow the instructions provided in “Using Gradle with IntelliJ” on Canvas. CourseNana.COM

Create a separate package for each problem in the assignment. Create all your files in the appropriate package. CourseNana.COM

To submit your work, push it to GitHub and create a release. Refer to the instructions on Canvas. Your repository should contain: ● One .java file per Java class. ● One .java file per Java test class. ● One pdf or image file for each UML Class Diagram that you create. UML diagrams can be generated using IntelliJ or hand-drawn. ● All non-test classes and non-test methods must have valid Javadoc. CourseNana.COM

Your repository should not contain: ● Any .class files. ● Any .html files. ● Any IntelliJ specific files. CourseNana.COM

Problem 1

Implement an ADT called NationalParkDirectory—an ordered, mutable collection, which will be used by the Department of Interior, to keep track of information about of the country’s national parks. This information will include resources about destinations and amenities, lodging, camping, permits and lotteries, as well as relevant information about the current conditions in each park. CourseNana.COM

A NationalPark class has already been written to store information about each national park (download it from the Canvas page for this assignment). The ADT will need to support the following functionality. CourseNana.COM

  • Boolean isEmpty(): checks whether or not the NationalParkDirectory is empty.
  • Integer count():gets the number of NationalParks in the NationalParkDirectory.
  • Boolean contains(NationalPark): checks if the provided NationalPark exists in the NationalParkDirectory.
  • void addNationalPark(NationalPark park): adds a new NationalPark to the NationalParkDirectory. Please note that NationalParkDirectory does not allow duplicate NationalParks, but it allows information about some NationalPark to change. So, if a NationalPark already exists in the NationalParkDirectory, method add() will replace the existing values of the NationalPark’s fields with the newly provided information.
  • void removeNationalPark(NationalPark park): removes a specified NationalPark from the NationalParkDirectory. If the NationalPark does not exist in the NationalParkDirectory, the system should throw NationalParkNotFoundException, which you will have to implement yourself.
  • NationalParks[] findParksWithinTheState(String state): finds and returns all NationalParks from the NationalParkDirectory that are located within the state provided as an input argument. NationalPark getParkByID(String nationalParkID): gets a NationalPark from the NationalParkDirectory based upon the NationalPark’s unique identifier, nationalParkID. The system throws an InvalidNationalParkIDException if the given unique ID doesn’t exist. You are expected to implement InvalidNationalParkIDException for yourselves.

Specify this ADT in an interface and implement it as well as any other classes needed to satisfy the specification. You should also implement toString, equals, and hashCode for this ADT. You may not use any built-in Java collections, other than arrays, as the underlying data structure. Please do not modify the provided NationalPark class. CourseNana.COM

Problem 2

Provide the design and implementation of a Set, as in the mathematical notion of a set. Here is the specification: CourseNana.COM

  • Set emptySet(): Creates and returns an empty Set. CourseNana.COM

  • Boolean isEmpty(): Checks if the Set is empty. Returns true if the Set contains no items, false otherwise. CourseNana.COM

  • Set add(Integer n): Adds the given Integer to the Set if and only if that Integer is not already in the Set. CourseNana.COM

  • Boolean contains(Integer n): Returns true if the given Integer is in the Set, false otherwise. CourseNana.COM

  • Set remove(Integer n): Returns a copy of the Set with the given Integer removed. If the given Integer is not in the Set, returns the Set as is. CourseNana.COM

  • Integer size(): Gets the number of items in the Set. CourseNana.COM

Your implementation of equals(Object o) should return true if and only if the two sets have the same number of elements and, for every element in this, the same element exists in o and vice versa. Ensure that your implementations of hashCode() and equals() satisfy the contracts for both methods. CourseNana.COM

You may not use any built-in Java collections, other than arrays, as the underlying data structure. As the specification suggests, your implementation should be immutable. Make sure your implementations for both problems are thoroughly tested. Please also provide UML diagrams. CourseNana.COM

Get in Touch with Our Experts

QQ QQ
Wechat WeChat
Whatsapp Whatsapp
Java代写,Object-Oriented Design代写,CS 5004代写,US代写,NEU代写,Northeastern University代写,Java代编,Object-Oriented Design代编,CS 5004代编,US代编,NEU代编,Northeastern University代编,Java代考,Object-Oriented Design代考,CS 5004代考,US代考,NEU代考,Northeastern University代考,Javahelp,Object-Oriented Designhelp,CS 5004help,UShelp,NEUhelp,Northeastern Universityhelp,Java作业代写,Object-Oriented Design作业代写,CS 5004作业代写,US作业代写,NEU作业代写,Northeastern University作业代写,Java编程代写,Object-Oriented Design编程代写,CS 5004编程代写,US编程代写,NEU编程代写,Northeastern University编程代写,Javaprogramming help,Object-Oriented Designprogramming help,CS 5004programming help,USprogramming help,NEUprogramming help,Northeastern Universityprogramming help,Javaassignment help,Object-Oriented Designassignment help,CS 5004assignment help,USassignment help,NEUassignment help,Northeastern Universityassignment help,Javasolution,Object-Oriented Designsolution,CS 5004solution,USsolution,NEUsolution,Northeastern Universitysolution,