Determining Super Bowl victories with JSoup: Your task will be to use the JSoup API, scrape the
Question:
Determining Super Bowl victories with JSoup:
Your task will be to use the JSoup API, scrape the relevant data (see below) from a given website, and to neatly display the information gathered.
The following website contains a table consisting of every super bowl ever played, including Game, Data, Champion, Score, Opponent, and Location.
For the purpose of this assignment, we only care about the Champion column.
https://blog.ticketcity.com/nfl/super-bowl/super-bowl-champions/
Before you begin, you should review the source code of the given website to see the structure you will be dealing with, and to pick out any particular sections you may need/want to use.
Count how many times a given team has won the Super Bowl, based on the information scraped | |
from the given website. |
- Design a String array to store all 58Note: There have only 57 current super bowl games, but the website has prepared for the 23/24 super bowl LVI so the array must match, therefore a size of 58) super bowl winners (Including this years TBD)
(DO NOT assign values)
- Load the given website as a Document object using JSoup API
- Design an Elements object to hold all "td" elements (This is where our desired data is stored, BUT be careful, there is also data we do not want to be contained in TD's)
- Use an enhanced for loop to iterate through each TD, the trick here is to come up with some algorithm (or IF) to determine whether we care about the TD we are currently looking at
(HINT: if we think of the table as an array, we care about index 2, "Champion")
- Store the text of the given element (The winner) in the array, and increment some variables (1 for keeping track of winners and 1 for keeping track of the overall count, HINT: you may want to reset this one every time we get to the end of a row..)
Once you have stored all winning teams:
- Prompt the user for their favorite team, determine whether or not they exist in the array, keep track of how many times they appear within the array, and then print the appropriate message/variables
Operations Management Managing Global Supply Chains
ISBN: 978-1506302935
1st edition
Authors: Ray R. Venkataraman, Jeffrey K. Pinto