CS 2337 – PROJECT 2 – Mario Super Sluggers 2 (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: Use object-oriented programming to implement and utilize a linked list data structure
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 each class o You do not have to include pseudocode for basic items like constructors, accessors, mutators
• 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 10 test cases you will check during testing (other than the examples below) o Specific input is not necessary o Describe what you are testing o Examples:
▪ Processing 3 leaders for first place ▪ Sorting list in reverse alphabetical order
Zybooks Information:
• You will have multiple source files
Main.cpp
o Linklist.h and Linklist.cpp o Node.h and Node.cpp
o Player.h and Player.cpp
o Based on your design, the .cpp file may be empty
• Core implementation has unlimited submissions o This will help you make sure the basic actions of your program are working properly in the environment
• Final submission is limited to 10 submissions
• White space will not be checked

This will project will extend the basic logic and retain most of the requirements of Project Zero. Differences from Project Zero will be written in blue.
Details:
• Classes o Use good programming practice for classes – proper variable access, mutators and accessors, proper constructors, etc.
o Remember that classes exist to be used by other people. Just because you don’t use it in the program doesn’t mean it shouldn’t be coded and available for others to use in theirs.
o As with previous projects, you are open to design the classes as you see fit with the minimum requirements listed below
o Both classes must be of your own design and implementation.
o Requirements
▪ Linked list class
• Head pointer
• Recursive toString function
• A sort function of your own design ▪ Node class
• Next pointer
• Player object
• EXTRA CREDIT: Make Node templated instead of using a Player object within
Node (+10 points) o If templated, no references to Player o Linked list will also need to be templated because the head pointer will need to be of a templated node type o No references to Player inside linked list class ▪ Player class
• Design class to hold stats and name o Do not hold stats that are calculated from other stats o Use functions to calculate when needed o This prevents stale data
Based on your design, your cpp files may be empty

• Start the program by prompting the user for the input filename • All nodes added to the linked list will be added to the end
• 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 value for each category o There may be ties for the leaders o If there is a tie, output all names for tied value
• All data must be held and manipulated in a linked list of your design (-20 points if not)
Input: All input will be read from a file. Each player’s data will be listed on separate lines in the file and will follow the same format.
• Format: <name><space><batting record>
o Mario HOOKWSHHKOHPWWHO
• The name will be a single word.
• The batting record will be a series of capital letters representing various results during a baseball game o H – hit o O – out o K – strikeout o W – walk
o P – hit by pitch o S – sacrifice
• Walks, sacrifices and hit by pitches are not considered an at-bat
• Batting records may contain invalid characters. o If an invalid character is encountered, disregard it o Invalid characters are not counted as an at-bat
• Each line in the file will end in a newline (except the last line of the file which may or may not have a newline)
• The batting record for each person may not have the same number of results
• The input file may have multiple entries for the same person o Combine that data into one node for the player
Output:
• All output will be written the console
• All floating-point values are displayed to 3 decimal places
• Display each player’s data in the following order with a tab between each field
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)
• Output the player data by name in alphabetical order (A to Z)
• After the player data table, display an additional newline and the LEAGUE LEADERS header
• Display the top 3 leaders for each category
• 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.
• When displaying the leader list, separate each name with a comma and a space o Arrange the leader list in alphabetical order
• League Leader Order o Batting Average o On-Base Percentage o Hits o Walks o Strikeouts o Hit By Pitch
• League Leader Output Format o <CATEGORY><newline>
▪ All caps o <value><tab><first leader list><newline> o <value><tab><second leader list><newline>
▪ Second leader list is optional
▪ No second place if first place has 3 or more ties o <value><tab><third leader list><newline>
▪ Third leader list is optional
▪ No third place if first or second place has a tie
o <newline>

Reviews

There are no reviews yet.

Be the first to review “CS 2337 – PROJECT 2 – Mario Super Sluggers 2 (Solution)”

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