Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Assignment – 1

PROG32356 – .NET Technologies using C#


Instructor: Gursharan Singh Tatla
Email: gursharan.tatla@sheridancollege.ca

Note:
1. Assignment must be completed as an individual effort. Do not collaborate with anyone or
share it with any individual, party or entity.
2. Due date for submission is specified in SLATE.
3. All online submissions will be done via SLATE (Email submissions will NOT be accepted).
4. Late assignments will be penalized 10% each day for up to 3 days. After that, it is worth 0.
5. Corrupt/incorrect submissions will be graded as zero.
6. Please refer to the Academic Integrity Policy.
7. Refer to the School of Applied Computing's Academic Procedures for Evaluations for more
details regarding missed work: Procedures for Evaluations.
8. If you take code-snippets from somewhere such as StackOverflow, make sure to provide
references to the webpages as comments in your code.

Copyright Disclaimer:
The materials provided in class and in SLATE are protected by copyright. They are intended for
the personal, educational uses of students in this course and should not be shared externally
or on websites such as Chegg, Course Hero or OneClass. Unauthorized distribution may result
in copyright infringement and violation of Sheridan policies.
Gursharan Singh Tatla (Winter 2023)
Instructions:
1. Make a Console Application in Visual Studio and name it as A1YourFirstnameLastname.
2. Implement a sports player stats management system which is capable of doing the following:
• Add, edit, and delete player stats.
• View and search player stats.
3. The application must be menu-based app:
1 - Add Player
2 - Edit Player
3 - Delete Player
4 - View Players
5 - Search Player
6 - Exit

4. When selecting Add, Edit or Delete Player option from the above menu, display a sub-menu
which asks which sports player is being added, edited, or deleted.
5. For example, if user selects 1 - Add Player, then display the following sub-menu:
1 - Add Hockey Player
2 - Add Basketball Player
3 - Add Baseball Player
4 - Back to Main Menu

Page 1 of 4
6. The menu should run continuously until the user quits the application.
• Validate the inputs. Any invalid input should not crash the app.
• Display user-friendly messages wherever necessary.
• Always display the player stats in a tabular form.
• Always display column headers when displaying player stats.

7. NOTE: At no point should the application save any information to disk. All information is
stored and managed in memory using a generic collection. The use of collections and the
object-oriented design of the solution are an important part of the evaluation of your
submission.
Gursharan Singh Tatla (Winter 2023)
8. Add Player:
• When adding a new player, ask the user for all the required info and then save it to
the collection.
• Then display a success message and print all the players from that sport in a tabular
form to verify that the new player is added.
• NOTE: When adding a new player, do not ask for Player ID, rather generate a new one.
The Player ID must be unique for every player, just like a primary key in database.

9. Edit Player:
• When editing a player info, first display a list of all players from the selected sport.
• Then ask the user for the Player ID of the player that user wants to edit and fetch that
player from the collection.
• And ask the user for all the required info and then display a success message.
• Print all the players from that sport in a tabular form to verify that the player is edited.
• NOTE: Do not ask the user to edit the Player ID. It must be unique for every player and
must not be edited.

10. Delete Player:


• When deleting a player info, first display a list of all players from the selected sport.
• Then ask the user for the Player ID of the player that user wants to delete and fetch
that player from the collection.
• And remove the player from the collection and then display a success message.
• Print all the players from that sport in a tabular form to verify that the player is
deleted.
Gursharan Singh Tatla (Winter 2023)
11. View Players:
• Display all the players in a tabular form.
• Display column headers.
• Categorize the players based on their sports.
• Check the output video to get an idea.

Page 2 of 4
12. Search Player:
• Ask the user to enter the player’s name and display all the players that match the
search keyword.
• Partial match must fetch the results.
• Match should be case-insensitive, meaning if user enters lowercase “kyle” and the
player’s name is “Kyle” (with uppercase K), it must fetch the player.

13. The players belong to three different sports: Ice-Hockey, Basketball, and Baseball.
14. Create a parent class Player which must be declared as abstract.
15. Then derive three child classes from the Player class:
• HockeyPlayer
• BasketballPlayer
• BaseballPlayer
16. Use enum to represent different types of players. If you ever need to find what type of player
it is, do not compare it with string, rather make use of enum.
• Do:
if (playerType == PlayerType.HockeyPlayer)
Where, PlayerType is declared as an enum.
• Don’t:
if (playerType == "HockeyPlayer")
Gursharan Singh Tatla (Winter 2023)
17. The parent class Player has fields which are common to all players, such as:
PlayerType, PlayerId, PlayerName, TeamName, GamesPlayed
18. The parent class Player also declares an abstract method Points, which will be overridden
in the derived classes.

19. Class HockeyPlayer has fields:


Assists, Goals
• Override the Points method to calculate the hockey player’s points. Give 1 point for each
assist and 2 points for each goal.
• Total Points = Assists + (2 x Goals)

20. Class BasketballPlayer has fields:


FieldGoals, ThreePointers
• Override the Points method to calculate the basketball player’s points. Give 1 point for
each field goal (minus any 3-pointers) and 2 points for each 3-pointer.
• Total Points = (FieldGoals – ThreePointers) + (2 x ThreePointers)
Gursharan Singh Tatla (Winter 2023)
21. Class BaseballPlayer has fields:
Runs, HomeRuns
• Override the Points method to calculate the baseball player’s points. Give 1 point for
each run (minus any home runs) and 2 points for each home run.
• Total Points = (Runs – HomeRuns) + (2 x HomeRuns)

Page 3 of 4
22. Use your Java and object-oriented programming knowledge to create this hierarchy.
• NOTE:
i. Use C# properties to get/set these fields. Do not use getter/setter methods like
you would do in Java.
ii. Classes must be declared in their separate files, not in Program.cs file.
• You will get higher grades if:
i. Proper use of inheritance.
ii. User-Interface is user-friendly.
iii. App menu runs smoothly without crashing.
• Otherwise, there will be grade deductions.
Gursharan Singh Tatla (Winter 2023)
23. In the Program.cs file, create and maintain a generic collection of all players.
• The generic collection must be of type parent class Player and it must store objects of
derived classes.
• Populate this collection with some sample data when the program runs.

Submission:
1. Once done, ZIP the solution folder and upload it to Assignments on SLATE.
a. Make sure to ZIP the whole folder, not just .SLN file.
b. If only .SLN file is zipped and submitted, Grade 0 will be given.
c. Double-check your submission by downloading it and running it.
2. You are to submit .ZIP and .TXT files, separately:
a. Upload the .ZIP file of your assignment to SLATE.
b. Upload the .TXT files to SLATE.
3. You must copy and paste all of your source code from your C# files into separate plain text
files.
a. You can copy and paste the source code into Notepad.
b. Create a separate .TXT file for each source code file.
4. You don't have to format this code - it's used by TurnItIn (the originality checker in SLATE,
which is a piece of software that checks your submission for plagiarism against other
submissions in the college, in other colleges, from the web, and various other sources).
5. Submit these text files in addition to your assignment ZIP file.
a. DO NOT add them inside your zip/rar file - they must be separate files.
b. These are used for TurnItIn (it won't examine the contents of zip/rar files).
6. Note:
a. If these submission instructions are not followed, Grade 0 will be granted.
b. If TXT files are not provided, Grade 0 will be granted.

Sample Output:
• Check out this video to see the sample output of this application:
https://www.loom.com/share/22ecc6cae6b24555b182521f3bd1b485

Page 4 of 4

You might also like