Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help! the question and the starter code is provided. The txt files (coaches_season.txt) coachid,year,yr_order,firstname,lastname,season_win,season_loss,playoff_win,playoff_loss,teamRUSSEJO01 ,1946,1,John,Russell,22,38,0,0,BOSOLSENHA01 ,1946,1,Harold,Olsen,39,22,5,6,CH1DEHNEDU01 ,1946,1,Dutch,Dehnert,17,20,0,0,CL1CLIFFRO01 ,1946,2,Roy,Clifford,13,10,1,2,CL1CURTIGL01 ,1946,1,Glenn,Curtis,12,22,0,0,DE1SACHSPH01 ,1946,1,Philip,Sachs,8,18,0,0,DE1COHALNE01 ,1946,1,Neil,Cohalan,33,27,2,3,NYKGOTTLED01 ,1946,1,Eddie,Gottlieb,35,25,8,2,PH1BIRCHPA01 ,1946,1,Paul,Birch,15,45,0,0,PIT (teams.txt)

need help! the question and the starter code is provided.
The txt files
(coaches_season.txt)
coachid,year,yr_order,firstname,lastname,season_win,season_loss,playoff_win,playoff_loss,teamRUSSEJO01 ,1946,1,John,Russell,22,38,0,0,BOSOLSENHA01 ,1946,1,Harold,Olsen,39,22,5,6,CH1DEHNEDU01 ,1946,1,Dutch,Dehnert,17,20,0,0,CL1CLIFFRO01 ,1946,2,Roy,Clifford,13,10,1,2,CL1CURTIGL01 ,1946,1,Glenn,Curtis,12,22,0,0,DE1SACHSPH01 ,1946,1,Philip,Sachs,8,18,0,0,DE1COHALNE01 ,1946,1,Neil,Cohalan,33,27,2,3,NYKGOTTLED01 ,1946,1,Eddie,Gottlieb,35,25,8,2,PH1BIRCHPA01 ,1946,1,Paul,Birch,15,45,0,0,PIT
(teams.txt)
team,location,name,leagANA,Anaheim,Amigos,AAND,Anderson,Duffey Packers,NATL,Atlanta,Hawks,NBA1,Baltimore,Bullets,NBAL,Baltimore,Bullets,NBOS,Boston,Celtics,NBUF,Buffalo,Braves,NCAP,Capital,Bullets,N
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
In this project, you are expected to build a small database that stores data related to NBA coaches and teams. Users can send simple queries to this database, and add new data to the database. The database has two tables (or relations) - one for coaches and one for teams. The schemas for the two tables are as follows (and you must follow the schemas in this project): coaches (Coach_ID : consists of less than 7 capital letters and two digits, season : 4 digit year, first_name : any reasonable English name, last_name : any reasonable English name, season_win : non-negative integer, season_loss : non-negative integer, playoff_win : non-negative integer, playoff_loss : non-negative integer, team : capital letters and/or digits) teams (team_ID : capital letters and/or digits, Location: American City name, one or two English word(s), Name : team name, any reasonable English word, League : one capital letter) Your database should have a command-line interface to allow users to add data and send in queries. The interface accepts the following commands: 1. add_coach: add a new record describing the performance of one coach in one season. It should have the following 9 arguments: ID SEASON FIRST_NAME LAST_NAME SEASON_WIN SEASON_LOSS PLAYOFF_WIN PLAYOFF_LOSS TEAM, the types of which should match the schema of relation "coaches" mentioned above. Note the data file contains another field named yr_order but you should not include it in your database : 2. add_team: add a new record with one team's basic information. It should be followed by the following include it in your database; 2. add_team: add a new record with one team's basic information. It should be followed by the following 4 arguments: ID LOCATION NAME LEAGUE, the types of which should match the schema of the "teams" table; 3. load_coaches : bulk load of multiple coach/season records from a file specified by the only argument of the command. Note that the file stores each record in one line of text, and different fields of the line/record are separated by commas. In our sample files, you may find empty attribute values (nothing in between two commas) and you should still load that line into your database instead of rejecting it. 4. load_teams : bulk load of multiple team records from a file specified by the only argument of the command. Records in such files are organized in the same way as in those for load_coaches. 5. print_coaches: print a list of all coaches, with info about one coach's performance in one season in a line; 6. print_teams: print a list of all teams, with info about one team per line; 7. coaches_by_name : given a last name, print the information of coach(es) with that last name. You should also add the locations (city) and names of all teams he coached; 8. teams_by_city : given a city name, print the information of teams in that city and the names of all who coached teams in that city (each coach shown in a line): 9. best_coach: print the name of the coach who has the most net wins in a season specified by the only argument. Note that the net wins should be calculated as (season_win - season_loss) + (playoff_win playoff_loss). 10. search_coaches: print the info of coaches with the specified properties, which are given by the arguments in the following format: field=VALUE where field represents the name of a search criterion and 'VALUE' is the value of that field you want the query results to match. Multiple fields can be used in 10. search_coaches: print the info of coaches with the specified properties, which are given by the arguments in the following format: field=VALUE where field represents the name of a search criterion and 'VALUE' is the value of that field you want the query results to match. Multiple fields can be used in the same query. For example, a command "search_coaches first_name = John season_win =40 " means "finding all performance data of a coach with first name 'John' who had a seasonal win of 40". Note that a meaningful field should match exactly one of the column names in the coaches table (just ignore those that do not match any column names). A coach's last name can be two words with a space in between (e.g., van Gundy). Your code should be able to handle this. There will be testcases that search by such names. In order to not confuse your program, we will add a " + " sign between the two words of the last name in the testcases. For example, coaches_by_name van+Gundy Obviously, your job here would be to process the argument by replacing the " + " sign with a space before you do the search. The same should be done for city names and other commands such as add_coach and add_team. System. out.println(X: "search_coaches field=VALUE - print the name of the coach satisfying the spe System, out.println(x: "exit - quit the program"); return true; / * @param args *) Run | Debug public static void main(String[] args) new P1(). run(); \} . System. out.println(x: "search_coaches field=VALUE - print the name of the coach satisfying the spe System. out.println(x: "exit - quit the program"); return true; F * @param args */ Run |Debug public static void main(String[] args) new P1(). run(); \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions