Assignment 6 – Football Player Class & Collection Module
Assignment 6 will have the same physical form requirements as assignment 5 (see assignment 5 pdf attached to this assignment) – meaning the “Add” button should not show up until “Calculate” is clicked, it should disappear when the combobox is selected, etc. However, there will be changes in how the players are stored. Instead of using an array, you will create a collection of objects following the details below. You are welcome to use the code attached to complete assignment 6 (my solution to assignment 5) or use your own. Note that in this assignment, there is no maximum number of football players that can be added to the collection.
Add a module to your project that defines the football player object collection. The module must also contain an AddPlayer function that receives a FootballPlayer object (as defined in the FootballPlayer Class below). You can use the CompSciStudentModule.vb file from Tutorial 12-4 (attached to this assignment as well) as an outline for what is needed.
Create a FootballPlayer class that defines a football player object. A FootballPlayer object has three properties that can
be set (name, position, decimal points) and one property that is read only (integer points). You can use the GeneralStudent.vb file from Tutorial 12-4 as an outline for what is needed.
The class should contain the following features:
Public Sub New() – creates a new football player with default values
Public Property Name() – gets/sets the football player’s name, returns a string
Public Property Position() – gets/sets the football player’s position, returns a string
Public Property DecimalPoints() – gets/sets the football player’s decimal points, returns a double
Public ReadOnly Property IntegerPoints() – gets the football player’s integer points, returns an integer Public Overrides Function ToString() – overrides the general Object ToString method to return a single string that can be used to display all data as a single string (e.g. “Eli Manning-QB 28.42pts. 28pts.”) Since the IntegerPoints property is read only, you should convert the double point value stored for the football player to an integer and return that value in the get statement.
Instead of adding the player to the array when the “Add” button is clicked, you will add the player to the collection as defined in the module. When you click the “Show” button, you must loop through the collection and add all of the players stored to the listbox on the form. Again, Tutorial 12-4 has good examples on how these requirements are done.
There is one major logic flaw in how points are currently being calculated for one of the positions. If you find and fix the error, you can receive up to 15 bonus points (depending on your fix).
Assignment 5 – List of Players
Modify the Fantasy Football application to be able to add a player name, their position, and their fantasy
football points (both integer and decimal) to a multi-dimensional string array. On the interface include a
listbox that will allow the user to show the list of players saved in the array.
Add Player (Textbox / Button / 15 points) – Add a textbox and a button labeled “Add” that will add that
player to the array. In order to add a player, the “Calculate” button must have been clicked (e.g. it
shouldn’t appear until the “Calculate” button is clicked, which means it should also disappear when
“Clear” is selected or the position combobox is changed). Once the “Add” button is clicked, a
messagebox should appear to denote the player was added to the array. Note the listbox is not updated
when a player is added – only when the “Show Players” button is clicked.
Show Players (Listbox / Button / 10 points) – Add a listbox and a button labeled “Show” that will display
a list of players, their position, and their decimal and integer points inside the listbox. If no players are in
the array, a messagebox should appear with a message stating the array is empty.
Clear Players & Maximums (Array / Button / 15 points) – Add a button labeled “Clear List” that will
remove all the players from the array. If this button is clicked, the listbox should also be cleared. The
array should hold a maximum of 10 players.
Error Handling & Logic (10 points) – All textboxes and point labels should be cleared when the “Add
Player”, “Show Players”, or “Clear Players” button is clicked. “Add Player” should not be able to be
selected until the “Calculate” button is clicked.