Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives: We know the benefits of using classes in java. However, what if we want to create a class inside of a class? Is this
Objectives: We know the benefits of using classes in java. However, what if we want to create a class inside of a class? Is this even possible? Yes, it is This is known as nested classes. A programmer may want to do this when they want to group classes logically increase encapsulation, and make code more maintainable and readable. By completing this assignment, students will demonstrate knowledge of creating nested classes.
Task Description: The sports association wants you to continue development of the soccer league. Using your previous assignment on the soccer league, you will add some additional features. They want to be able to track ingame statistics. These should be built in as nested classes in the Player and Team classes.
Class Layout Game and Coach classes are omitted because they do not change:
Team Class:
Name
City
Color
RosterArrayList of players
Statistics Class:
Team Goals
Team Assists
Team Tackles
Wins
Losses
Ties
Player Class:
Name
Age
Position
Team
Statistics Class:
Goals
Assists
Tackles
Saves Goalkeeper saves
You are supplied with a playerStats.txt file. This file contains the statistics for players. Each player is identified by name and team name. These statistics are taken from different games, so as they are being read each they should be added to the appropriate player's stats as well as the team's stats.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started