didn't understand the previous code and it didn't run to my software . can you do it again? I use intelliJ IDE to code in JAVA.  Thank you

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

I didn't understand the previous code and it didn't run to my software . can you do it again? I use intelliJ IDE to code in JAVA. 

Thank you 

learned
building a Team, and the Player for a sport and test them out with Iterators.
Player
The players in the team should be represented by a Player class that has a name, and a position (their
number on the team). It also needs a default constructor (no arguments) that gives a default name and
position of 0. Two instances of Player are equal to each other when the name and position is equal.
Team
A team has a name, a roster of players (an ArrayList), and a maximum number of players. Make use of
the Iterator from the roster to implement the following:
We'll be
contains: Check if a Player is in the roster.
insert: Insert a Player into the roster. Cannot add a duplicate player, and you cannot add
more than the maximum number of players. Throw an exception in those cases like so:
public void makeError () throws Exception {
}
throw new Exception("This is an exception message.");
iterator: A public method to expose the iterator for your roster of players.
Don't use anything other than the iterator, size, and add method from your ArrayList variable.
Transcribed Image Text:learned building a Team, and the Player for a sport and test them out with Iterators. Player The players in the team should be represented by a Player class that has a name, and a position (their number on the team). It also needs a default constructor (no arguments) that gives a default name and position of 0. Two instances of Player are equal to each other when the name and position is equal. Team A team has a name, a roster of players (an ArrayList), and a maximum number of players. Make use of the Iterator from the roster to implement the following: We'll be contains: Check if a Player is in the roster. insert: Insert a Player into the roster. Cannot add a duplicate player, and you cannot add more than the maximum number of players. Throw an exception in those cases like so: public void makeError () throws Exception { } throw new Exception("This is an exception message."); iterator: A public method to expose the iterator for your roster of players. Don't use anything other than the iterator, size, and add method from your ArrayList variable.
Let's run some tests to ensure that your code is running correctly!
1. Create Team A, a team with the name "Tigers". Create another team, Team B, using the default
constructor. The maximum number of players should be 17.
2.
Add two players built with the default constructor to Team A and catch the exception that is
thrown using a try/catch statement. In the catch section, print the stack trace or another helpful
message:
try {
throw new Exception ("This is an exception message.");
}catch (Exception e) {
e.printStackTrace ();
3. Fill up both teams with players.
4. Try inserting more players after filling them and handle the exception.
5. Test to see if contains is consistent in its results.
6. Finally, iterate over the team rosters and legibly output all the players.
Transcribed Image Text:Let's run some tests to ensure that your code is running correctly! 1. Create Team A, a team with the name "Tigers". Create another team, Team B, using the default constructor. The maximum number of players should be 17. 2. Add two players built with the default constructor to Team A and catch the exception that is thrown using a try/catch statement. In the catch section, print the stack trace or another helpful message: try { throw new Exception ("This is an exception message."); }catch (Exception e) { e.printStackTrace (); 3. Fill up both teams with players. 4. Try inserting more players after filling them and handle the exception. 5. Test to see if contains is consistent in its results. 6. Finally, iterate over the team rosters and legibly output all the players.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Design of User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education