Problem Description Nintendo’s human resources data is all out of order, full of duplicates, and…

Problem Description

Nintendo’s human resources data is all out of order, full of duplicates, and in metric! The information is stored in a database file, hr.txt and it’s your task to create two new versions of it.

List of classes that you will write:

  • Main
  • Person
  • PersonList
  • PersonSet
  • PersonImperialSet
  • PersonOrderedSet

Your task is the following:

  1. Write a class named Person. This will be a very basic class with three attributes for storing name, height, and weight information. This class should also have a toString method that returns the Person data in a database-ready format.
  2. Write an interface named PersonList. The interface should have two abstract methods:
    1. add – This method takes a Person as input and returns void.
    2. get – This method takes an int as input and returns a Person at the corresponding index of the input int.
  3. Write a class named, PersonSet, that implements the interface PersonList. In addition to implementing add and get methods, PersonSet must make sure that no duplicate Persons are added. An array or an ArrayList may be used to implement this class, but a Set may not be used. The point is to implement the set yourself.
  4. Write a class named, PersonOrderedSet. This class should extend PersonSet and modify the add method to add Persons in alphabetical order by name.
  5. Write a class named, PersonImperialSet. This class should extend PersonSet and modify the add method to convert the height measurement from centimeters to inches and the weight from kilograms to pounds.
  6. Write a Main class to instantiate a PersonOrderedSet and a PersonImperialSet, read in the data, populate both the set objects with data and then write out the data into two separate output files (one ordered and one imperial). I recommend adding methods to the classes to get the data in a text format for writing to file. You should think about which class is most appropriate for this method (or methods) to be implemented in order to reduce code duplication.
  7. Lastly, output the ordered data and the imperial data to the screen/console, nicely formatted in rows and labeled columns (in other words, use System.out.printf).

Various Important Notes:

Neither PersonOrderedSet nor PersonImperialSet should contain duplicate date, but the code that takes care of such things should be implemented in the add method of PersonSet.

You must use super.add(c) as the final step in PersonImperialSet.add after the conversion has been completed. (Assuming that c is a variable referring to a Person object to be added to the set.)

You are strongly encouraged to use super.add(c) in PersonOrderedSet.add and then perform a sort of the data to make sure everything is in order. (Assuming that c is a variable referring to a Person object to be added to the set.)

You need to open the database file, hr.txt, and read in the information in Main.

Objects are passed by reference, not by value. If you add the same Person to PersonOrderedSet and PersonImperialSet you will see that the units get changed from metric to imperial in both. This is NOT what you want. One solution to this problem is to instantiate two new Person objects and pass the same name, height, weight info to each, and then pass one to the imperial set and the other to the ordered set. Another solution is to overload the Person constructor so that you can pass a Person type variable to the constructor and the constructor will take care of copying the data. This solution will still require two separate instantiations of Person in main.

If you want to use the ArrayList contains method to see if a Person is already in the set, then you need to make sure that Person overrides the default equals method. To do so, fill in the following comment outline and also refer to this resource for more information:

https://www.geeksforgeeks.org/overriding-equals-method-in-java/

//Equals method outline

@Override

public boolean equals(Object o)

{

//if Object o is null then return false

//if Object o == this then return true

//if Object o is not an instance of Person then return false

//Declare a new variable of type Person (perhaps named p)

// and assign it to Object o cast as type Person

//if Person p has the same name, height, and weight as

// this then return true

//else return false

}

I will test your program as follows:

javac Main.java

java Main

========================================================================================

hr.txt

Name Height (cm) Weight (kg)
Mario 155 90
Luigi 158 83
Bowser 310 726
Toad 41 7
Mario 155 90
Peach 183 60
Toad 41 7
Bowser 310 726
Bowser 310 726
Toad 41 7
Mario 155 90
Peach 183 60
Peach 183 60

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!