CS 2337 – PROJECT 4 – Super Mario World Series (Solution)

$ 30.00
Category:

Description

KEY ITEMS: Key items are marked in red. Failure to include or complete key items will incur additional deductions as noted beside the item.
Submission and Grading:
• Programs must compile using gcc 7.3.0 or higher with the following flags enabled o -Wall o -Wextra o -Wuninitialized o -pedantic-errors o -Wconversion
• Type your name and netID in the comments at the top of all files submitted. (-5 points)
Objective: Utilize common features of a hash table in the design of an object-oriented program
Problem: Nintendo is developing a new Mario baseball game for Nintendo Switch. As an (unpaid) intern for Nintendo this semester, you have been given the task of developing a system to calculate player stats and determine the league leaders in several different baseball categories, such as hits, strikeouts and walks.
Pseudocode: Your pseudocode should describe the following items
• Identify the functions you plan to create for your main file o Be sure to explain how you plan to use the hash tables, including how you will retrieve and use the team data and leaders
• For each function, identify the following o Determine the parameters o Determine the return type o Detail the step-by-step logic that the function will perform
• A list of at least 15 test cases you will check during testing
Zybooks Information:
• You will have multiple source files
o Main.cpp o GenericHashMap.h o Player.h o Player.cpp
• Final submission is limited to 20 submissions
Classes
• Use good programming practice for classes – proper variable access, mutators and accessors, proper constructors, data hiding, etc.
• As with previous projects, you are open to design the classes as you see fit
Details:
• Start the program by prompting the user for the play-by-play filename.
• This program will calculate stats based on the game play-by-play o Each possible plate appearance is provided in a file named keyfile.txt
▪ This will be used for every test case
▪ Do not prompt for this file o Each player’s plate appearance will be given in a file o Analyze each plate appearance to determine the result (hit, out, strikeout, etc.) o Record the information for each player and determine leaders
• Hash tables will be used for quick lookup of results and players (-15 points if not) o After reading the play, a hash table will be used to determine the result (i.e. H, O, K, etc.) o For example, a play of 1B (single) is a hit (H) (which as you know is also an at-bat and a plate appearance)
o The result is then recorded for the player
▪ Use a hash table to find the player and update the stats o You may utilize the unordered_map in the std namespace o EXTRA CREDIT (+10 points)
▪ Instead of using the built-in hashmap, create your own hashmap class
▪ Make the hashmap class generic
▪ Implement double hashing for collision handling ▪ Implement a rehashing function
• The size of the new hashmap will be the next highest prime number after doubling the old size
▪ If you use the built-in C++ hashmap you must submit an empty file named GenericHashMap.h
• Stats will be calculated for the following categories:
o Batting Average (BA)
▪ Batting average = hits / at-bats o On-base percentage (OB%)
▪ On-base percentage = (hits + walks + hit by pitch) / plate appearances o Strikeouts (K) o Walks (BB) o Hit by Pitch (HBP) o Hits (H)
• Calculate all stats per person and record the highest values for each category o There may be ties for the leaders o If there is a tie, output all names for tied value
• Any global variables used must be constant
• Use as few variables as possible
Input: All input will be read from a file. Each line in the file will represent a plate appearance and will follow the same format.
• Line format: <H/A><space><player name><space><plate appearance>
o H Mario 6-3
• The name will be a single word.
• The plate appearance will be a sequence of characters (a code) describing what happened o All plate appearance “codes” will be valid and will be present in the results file provided
• Errors are considered an at-bat
• Walks, sacrifices and hit by pitches are not considered an at-bat
• Each line in the file will end in a newline (except the last line which may or may not have a newline)
• The total number of plate appearances may be different for each player
• The input file may have multiple entries for the same person o If so, combine data for the player
Output:
• All output will be written to the console
• Divide the player information into home and away teams.
• For each team, the player names will be in alphabetical order with his/her data on the same line
• Output format for the away team
o AWAY
o Player data – display each player’s data in the following order with a tab between each field o Player name o At-bats o Hits o Walks o Strikeouts o Hits by pitch o Sacrifices o Batting average o On-base percentage o Write a newline after the on-base percentage (there is no tab before the newline)
• After all away data has been displayed, display another newline o This will put a blank line between the Home and Away sections
• Display the Home team data with the same format as the Away team o Display HOME instead of AWAY
• After the player data table, display an additional newline and the LEAGUE LEADERS header
• Display the top 3 leaders for each category o League leaders may be on the home or away team
• Because of ties all places may not be awarded. o For example, if there is a 3 way tie for first, there would not be a second or third place.
o See the output for more information on ties o If there are ties on both teams, list all away players first and then the home players
▪ The names on each team will be in alphabetical order
League Leader Order
• Batting Average
• On-Base Percentage
• Hits
• Walks
• Strikeouts
• Hit By Pitch
League Leader Output Format
• <CATEGORY><newline> o All caps
• <value><tab><first leader list><newline>
• <value><tab><second leader list><newline> o Second leader list is optional
o No second place if first place has 3 or more ties
• <value><tab><third leader list><newline> o Third leader list is optional
o No third place if first or second place has a tie
• <newline>

Reviews

There are no reviews yet.

Be the first to review “CS 2337 – PROJECT 4 – Super Mario World Series (Solution)”

Your email address will not be published. Required fields are marked *