CS209A Analysis of the Olympic Historical Dataset

hellyou發表於2024-10-20

[CS209A-24Fall] Assignment 1 (100 points)

This summer, we've enjoyed the Olympic Games Paris 2024. Many of us are still reliving the exciting momentsof the summer Olympics, and many of us may be interested in the event of past Olympics and the pastperformance of our favorite athletes.In this assignment, we provide a large dataset of Olympic games from 1896 to 2022. The dataset containsathlete bio and athlete-event data, including both team and individual sports, from all Winter/SummerOlympics (1896-2022). The dataset contains 6 csv, with the following relation:The data should be self-explanatory. Please check the column name and the above diagram carefully tounderstand the data.

Analysis of the Olympic Historical Dataset

In this assignment, you will design an OlympicsAnalyzer class, which could read the dataset and performvarious useful analyses. You are encouraged to use the Java features we recently introduced, such asCollections, Lambda, and Streams, whenever possible.

The OlympicsAnalyzer class has one constructor that reads a dataset file from a given path.public OlympicsAnalyzer(String datasetPath)This class also has 5 other methods that perform data analyses. You'll implement these methods in theOlympicsAnalyzer class. Method details are described below.

  1. Top 10 Performant Female Athletes in Individual Sportpublic Map<String, Integer> topPerformantFemale()A1.md2024-09-292 / 3This method returns a <name, count> map of size 10, where:the key is the name of the female athlete.the value is the total gold medals acquired by that female athlete in individual sport (i.e., not teamsport).he map should be sorted by the descending order of count (i.e., from most to the least). If two athleteshave the same gold medal count, then they should be sortedby the alphabetical order of the name.
  1. BMI by Sports

public Map<String, Float> bmiBySports()This method returns a <sport, BMI> map, where:the key is the sport name (e.g., Athletics, Boxing, Diving, etc.)the value is theaverage BMI of the athletes of that sport. BMI is computed as weight/(height xheight) where the unit of height is the meter. The average BMI should be rounded to one decimalplace.You should consider all athletes with 代 寫 CS209A Analysis of the Olympic Historical Dataset valid height and weight inour data. The athlete should also haveparticipated in any Olympic events so that we know the sport type of that athlete.The map should be sorted by the descending order of average BMI (i.e., from highest to lowest). If twosports have the same average BMI, then they should be sorted by the alphabetical order of the sport name.

  1. Top 10 Least Appeared Summer Sportspublic Map<String, Set<Integer>> leastAppearedSport()This method returns a <sport, set of years> map with a size of 10, where:the key is the sport name (e.g., Athletics, Boxing, Diving, etc.)the value is set of summer Olympics years in which the sport appears.The map should be sorted by the ascending order of the size of the set (i.e., from least appeared to mostappeared). If two sports have the same occurrences, then they should be sorted by the alphabetical order ofthe sport name.
  1. Top 10 Countries by Medals in Winter Olympics since the year 2000public Map<String, Integer> winterMedalsByCountry()This method returns a <country, count> map with a size of 10, where:the key is the country code.A1.md2024-09-293 / 3the value is the sum of all medals, including gold, silver and bronze, acquired by that country in allWinter Olympics since the year 2000 (including 2000).The map should be sorted by the descending order of count (i.e., from most to the least). If two countrieshave the same medal count, then they should be sorted by the alphabetical order of the country code.

Top 10 Countries with Young Athletes in 2020 Summer Olympic

public Map<String, Integer> topCountryWithYoungAthletes()This method returns a <country, age> map with a size of 10, where:the key is the country name (not country code).the value is the average age of the athletes of that country that participate in 2020 Summer Olympic.For simplicity, you may ignore the exact month and day and only use the year of birth when computingthe age. For example, an athlete born in Dec 31 2000 can be considered as of age 20 in 2020. The

average age should be rounding to the nearest integer.Athletes with no born information should be ignored.The map should be sorted by the ascending order of average age (i.e., from youngest to oldest). If twocountries have the same average age, then they should be sorted by the alphabetical order of the countryname.

相關文章