讲解:CISC124、NHL Simulator、Java、JavaSQL|Prolog

CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 1Aim – To implement a simulation of an ice hockey season in one of the divisions of the NHL(National Hockey League) that would potentially allow a given team to estimate its chances ofmaking it to the playoffs. The simulation will run as a text-based, interactive, and menudrivenprogram that will comply with a set of rules as specified below.The objectives in this assignment are multiple. First, to build a small prototype of a data analysistool, using as input artificial data generated as pseudo-random numbers, which couldeventually grow to a robust hockey player performance evaluation tool using real NHLstatistical data. Second, to give you practice designing and coding simple classes and methodsusing loops, conditionals and console I/O in the Java language. Third, to give you an initialexposure to object-oriented techniques to solve computational problems.To attain the goals of this prototype, you will write the following Java classes:1) A class Player to keep track of identification and performance attributes for a hockeyplayer.2) A class Team to maintain hockey player configurations and team results.3) A class Game to simulate and capture the results of a hockey game.4) A main driver class NHLSimulator that will be able to simulate the results of each and allthe ice hockey games scheduled for an NHL hockey season and conference, respond toinquiries about individual players, handle the interactions with the user of thesimulation via a text-based interactive menu, and display on the user’s console aformatted report according to a given specification.General DescriptionAs a software developer, working for the administration office of the Toronto Maple Leafs icehockey team, you have been tasked to write a Java program that would simulate the results ofhockey games based on a random, range-limited estimation of the skill level of the playersinvolved in them. Executive management at this hockey club wants to have this simulation toolto estimate how well the current player roster would fare against other teams in its ownconference. They would like to know whether the team has a good chance of making it to theplayoffs this year. To meet this goal, the team needs to finish the regular season in at least the8th position in its conference.An annual NHL season is played in two conferences: Eastern and Western, each one having 16(see Table 1, Appendix A) and 15 teams, respectively. Your program will simulate game resultsbetween Eastern conference teams only, that is, interconference games are not included.Therefore, the final tallying of results and team positions in the Eastern conference will bebased only on the games specified above.During a regular hockey season, every Eastern conference team plays two games against everyother team in the same conference, one as a visitor and one as a host. If at the end ofregulation time, both times are tied (have scored the same number of goals), the game goes toovertime. For simplicity, we will consider that each game ends in regulation time or in overtime(i.e., no shootouts). The first team to score a goal in overtime wins the game. The game’ s CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 2winning team gets 2 points, and the losing team gets 0 points if the game ended in regulationtime, 1 point if it ended in overtime.For the simulation, we will consider that each team has 13 forwards, 8 defensemen and 4goalies, for a total of 25 players. Each player has a skill level (i.e., ability to play the game)represented by integers, between 1 (lowest) and 10 (highest). The skill levels for the TorontoMaple Leafs players are shown in Table 1, Appendix A (along with their player numbers andtypes (forward, defense or goalie).The program will randomly generate the skill levels for the players in the other remaining 15teams, using the skill level ranges provided in Table 2, Appendix A. For example, Boston’sforwards will get a randomly-assigned skill level between 5 and 9, defensemen will get aninteger between 4 and 9, and goalies an integer between 5 and 7. This same logic applies for allthe remaining teams in Table 2, Appendix A. The program will randomly assign to each player aunique integer identifier between 1 and 99. It will name the player as Fn (forwards), or Dn(defensemen), or Gn (goalies), where n is the identifier assigned to the player. It will also decidewhether a player is a forward, defenseman or goalie, respecting the quotas defined for eachplayer type (i.e., 13 forwards, 8 defensemen, 4 goalies).To simulate the outcome of a game involving two teams (let’s say teams 1 and 2), your programwill apply the following rules:1. Add up the skill level of all the forwards and defensemen in each of the two teams. Letus call these totals P1 and P2.2. Randomly select one of the 4 goalies in each team. Let us call the skill levels of thegoalies selected from teams 1 and 2 “G1” and “G2”, respectively.3. Compute the total skill levels for teams 1 and 2 as: T1 = P1 + G1 and T2 = P2 +G2,respectively.4. For each of the two teams, randomly decide whether its forwards, defensemen andgoalie will play well, poorly, or at their initially-specified skill level in the current game.5. If the forwards play well, add 25 points to the team’s total skill level (i.e., T1 = T1 + 25, orT2 = T2 + 25). If they play poorly, subtract 25 points from the team’s total skill level (i.e.,T1 = T1 - 25, or T2 = T2 - 25). If they play at their initially-specified skill level, do notchange T1 (or T2). Similarly, in the case of defense players, add or subtract 40 points. Inthe case of the goalie, add or subtract 60 points.6. During regulation time, each team will randomly score 0, 1 or 2 goals for each 50 pointscomputed in its total skill level computed for the current game (i.e., T1 and T2). It willscore 0 or 1 goals for a remainder fraction of 50 points.7. During overtime, each team will randomly select 3 players among forwards anddefensemen and will randomly select one of the four goalies. The total skill level for allthe 4 players will be computed in each team. The team whose total skill level, computedin this manner, is greater, will be the first to score one goal in overtime (and terminatethe game). If both totals are equal, your program will randomly decide which teamscored the first overtime goal.CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 3Program Implementation RequirementsI – User Interface and Program FlowUpon starting, the program will display on the console the following menu:NHL Simulator (Version 0.1). Author: [Your first and last name]1 – Simulate NHL Season (Eastern Conference)2 – View Team Skill Level Profile3 – Display End of Regular Season代写CISC124作业、代做NHL Simulator作业、代写Java程序作业、代做Java实验作业 调试数据库SQL TableSelect Option [1, 2 or 3] (9 to Quit):Upon completing the processing of any of the operations 1, 2, or 3, your program will return todisplay the previous menu and wait for the user to select a menu option. If the user enters 9,the program terminates.a) Simulate NHL Season (Eastern Conference) – Selecting this option will run a simulation of allthe 240 games in the Eastern Conference for the current regular season, using the algorithmdescribed in the “General Description” section. After completing the simulation, your programwill display the teams with the most and least points at the end of the regular season, asfollows:NHL Regular Season – Eastern Conference – 2018/2019First Team: [Team Name] Points: [# of Points]Last Team: [Team Name] Points: [# of Points]Simulation completed!Afterwards, the program will return to the main menu.b) View Team Skill Level Profile – Selecting this option will display the prompt:Enter Team Name:The user must enter one of the names listed in Table 2, Appendix A. If the name is invalid, theprogram must display:[Entered name] is invalid! Please re-enter or press [Enter]If the user just pressed [Enter] and no team name, then the program returns to the main menu.Otherwise, it displays:Enter Team Name:If the team name is valid, the program displays skill level data for all the players in the teamrequested, using the following format, and returns back to the main menu:No Name Position Skill Level*** ****************** ********** ********34 F34 Forward 8Etc.CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 4If the user selects this option without first running option 1: Simulate NHL Season (EasternConference), the program displays the following error message and returns to the main menu:Must run NHL Eastern Conference Simulation before accessing this option!c) Display End of Regular Season Table – Selecting this option will display the Total Scores andStatistics Report for the Eastern Conference, as of the end of the 2018/2019 regular season.The program lists the teams in alphabetical order (as shown in Table2, Appendix A), using theformat shown below, and returns to the main menu.TOTAL SCORES AND STATISTICS REPORTTeam Name GP W L OTL Pts GF GA DiffBoston 30 18 10 2 38 83 71 +12Buffalo 30 9 18 3 21 51 85 -44Etc.After displaying the report, the program will issue the prompt: Press any key to continue;thereafter, it will return to and display the selection menu.If the user selects this option without first running option 1: Simulate NHL Season (EasternConference), the program displays the following error message and returns to the main menu:Must run NHL Eastern Conference Simulation before accessing this option!II – TestingProduce a trace file named runlog.txt, which contains the logging of all the user interaction andoutput displayed on the console for the menu selections explained in section I, points a), b) andc). (Note: runlog.txt should include the output produced in “Total Scores and Statistics Report”).III – Analysis1) According to your run of the simulation, did the Toronto Maple Leafs make it to theplayoffs?2) If they didn’t, what do you think would be the minimum skill level required by thedefensemen and goalies in order to make it to the playoffs?3) If they did, what do you think would be the minimum skill level required by thedefensemen and goalies in order to end the regular season in first place?Provide your answers in a text file named answers.txt.CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 5III – SubmissionCompress the source code for classes NHLSimulator, Team, Player and Game, as well as filesrunlog.txt and answers.txt, into a single zip archive file named:[your student number]_Assignment1.zipFor example, if your student number is 12345678 then you will name your submission file as12345678_Assignment1.zipSubmit file [your student number]_Assignment1.zip via onQ by January 30, 2018, 11:00 p.m.IV – Marking Scheme Implementation of class NHLSimulator 3 points Implementation of class Player 3 points Implementation of class Team 3 points Implementation of class Game 3 points Generation of runlog.txt trace file 4 points Answers provided in answers.txt file 2 points Code style and documentation 2 points________TOTAL: 20 pointsV – Additional Guidelines for this Assignment Your program should use good indentation and white space, good variable names and someinternal comments explaining what the code is doing. One comment at the top of theprogram should contain at least your name, your NetID, date, and an overall description ofwhat your program does (3 to 4 lines). Use the Random class, in the java.util package, to create a random number generationobject seeded with an arbitrary number. For example, the following code accomplishes this:static Random generator = new Random(System.currentTimeMillis());System.currentTimeMillis() returns the current time in milliseconds, so it will yield a differentseed value every time you run your program. You need to call the nextInt() method (seedetails in the Java API documentation) in the generator object to obtain a new randominteger. This object could be assigned to an attribute of class NHLSimulator.CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 6Appendix ATable 1: Toronto Maple Leafs RosterNo. Name Position Skill Level28 C. Brown forward 563 T. Ennis forward 433 F. Gauthier forward 511 Z. Hyman forward 718 A. Johnsson forward 743 N. Kadri forward 724 K. Kapanen forward 826 P. Lindholm forward 812 P. Marleau forward 816 M. Marner forward 934 A. Matthews forward 929 W. Nylander forward 991 J. Tavares forward 1023 T. Dermott defenseman 851 J. Gardiner defenseman 42 R. Hainsey defenseman 53 J. Holl defenseman 652 M. Marincin defenseman 492 I. Ozhiganov defenseman 644 M. Rielly defenseman 922 N. Zaitsev defenseman 831 F. Andersen goalie 1030 M. Hutchinson goalie 750 K. Kaskisuo goalie 540 G. Sparks goalie 6CISC124 – Winter 2019Lab Assignment 1: NHL Simulator ToolPage 7Table 2: Teams in the Eastern ConferenceNo Team ForwardsSkill Level RangeDefensmenSkill Level RangeGoaliesSkill Level Range1 Boston 5 – 9 4 – 9 5 – 72 Buffalo 6 – 9 4 – 7 4 – 73 Carolina 4 – 8 5 – 7 4 – 94 Columbus 4 – 9 5 – 8 7 – 105 Detroit 4 – 7 6 – 8 4 – 66 Florida 5 – 7 4 – 8 5 – 97 Montréal 4 – 7 4 – 7 4 – 98 New Jersey 4 – 7 4 – 7 5 – 69 NY Islanders 6 – 8 5 – 7 6 – 810 NY Rangers 5 – 7 4 – 6 5 – 711 Ottawa 4 – 6 4 – 5 4 – 512 Philadelphia 4 – 6 4 – 6 4 – 713 Pittsburgh 6 – 10 4 – 7 5 – 714 Tampa Bay 6 – 10 6 – 10 7 – 915 Washington 6 – 10 5 – 8 6 – 8转自:http://ass.3daixie.com/2019013047522818.html

你可能感兴趣的:(讲解:CISC124、NHL Simulator、Java、JavaSQL|Prolog)