Develop an athlete class that has the persons name

Assignment Help JAVA Programming
Reference no: EM132080113

Need help writing this program in java.

Directions:

Your task is to develop an Athlete class that has the person's name, sport, and ranking, where the name and sport are Strings and the ranking is anything that is comparable (do NOT hardcode this to an int - use generics).

You should be able to sort athletes two different ways: alphabetically by sport and if two athletes have the same sport, they should be sorted alphabetically by name or alphabetically by sport and if two athletes have the same sport, they should be sorted in decreasing order of rank.

In your main method, create five Athlete objects, add them to an ArrayList, and display them. Then sort the ArrayList by sport and name and display the sorted list.

Finally, sort the array list by sport and ranking and display the sorted list again.

Hints: Because you need to sort the Athletes in two different ways, you will probably need to both implement Comparable and make a new Comparator class.

You may need to add getter methods for the fields in your Athlete class, and it might be helpful to override the toString method to make it easier to display the objects.

output example:

Unsorted

John Doe (baseball - 3)

Sam Johnson (football - 2)

Kevin Smith (baseball - 1)

Sally Johnson (swimming - 3)

James Smith (swimming - 4)

Meagan Kelly (swimming - 1)

Sorted by sport and then name John Doe (baseball - 3)

Kevin Smith (baseball - 1)

Sam Johnson (football - 2)

James Smith (swimming - 4)

Meagan Kelly (swimming - 1)

Sally Johnson (swimming - 3)

Sorted by sport and then ranking

Kevin Smith (baseball - 1)

John Doe (baseball - 3)

Sam Johnson (football - 2)

Meagan Kelly (swimming - 1)

Sally Johnson (swimming - 3)

James Smith (swimming - 4)

Reference no: EM132080113

Questions Cloud

What is the efficiency of the engine : In one cycle, a heat engine does 380 J of work and releases 700 J of heat to a lower-temperature reservoir.
Average velocity vrms equal to the moon : At what temperature would hydrogen molecules (molecular mass is equal to 2.016 g/mol) have an average velocity Vrms equal to the Moon's escape velocity?
Explain why the speed of sound is faster in solids : Explain why the speed of sound is faster in solids than in gases. Include two other factors what can the speed of sound depend onthe speed of sound can depend o
Analysis of possible design solutions : DESIGN REPORT - ANALYSIS OF POSSIBLE DESIGN SOLUTIONS - aid the creative process of generating new ideas, and briefly explain, in your own words
Develop an athlete class that has the persons name : Develop an Athlete class that has the person's name, sport, and ranking, where the name and sport are Strings and the ranking is anything.
How much time tmelts passes before the ice starts to melt : From the time when the heating begins, how much time trise does it take before the temperature begins to rise above 0degreesC?
What is needed to interface to the lcd : The pin numbers in thedefinition of LcdDriver are critical and are based on the traces from the schematic.
What is the maximum number of simultaneous calls : What is the maximum number of simultaneous calls a CDMA system with a processing gain of 30 dB, an Eb/No of 13 dB and inter-cell interference factor.
What is the value after the following code executes : The point of this test was to see our knowledge of "braces" locations within the code. So this code is missing braces.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd