Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 needs to be answered: In the same test program used in #2, add 2 static methods to be called from your main method:

Question 3 needs to be answered:

In the same test program used in #2, add 2 "static" methods to be called from your main method:

1) findTeamInfo() -- this method will be a void method; you will pass the team id and array of teams to the method as arguments and then in the method, loop through the array to find that team id. Output to the user if you find the team id or not and if you do find it, output all the team information for that team id.

Call the findTeamInfo() method after you prompt them to enter a team id in your main method.

2) isValidTeamId() -- this method is a value-returning method; it will return a boolean indicating if the team id you passed in is valid or not. You will call this method as the user is entering the team information (probably in a loop in the main method). You will pass to the method as arguments 2 things: the current array of objects AND the team id the user entered. In the method, it will loop through the array one at a time and see if it finds the ID sent in. If it finds it, then this is NOT a valid team id since it is already assigned to another team. In addition to checking if the team id is already used, you must also make sure that the team id is not a negative number. You will return back a boolean set to either true or false to indicate if the team id is valid. In the calling main method, you will ask the user to enter another id if this is not valid; else, you can continue to enter other team information.

Question #2:

Create a test file where you ask the user how many objects of the class from question #1 that you want to construct? (For example, if your class were a Dog, you would ask the user how many Dog objects they want to construct)

Make an array of that size and then prompt/ask the user for the information to make your objects (you cannot hardcode the information). Put your objects into this array that you created. (hint: see Section 7.7 in your book for a section on making an array of objects!)

Print out the contents of the array you created using a loop.

Insert your java file here after you test that it compiles and runs (you have a main method now!).

Select "Insert" menu , then select "Document", then "Upload Document" to post it here for credit.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions