PROGRAM INSTRUCTIONS: Code a program that tracks the wins-losses of the athletic teams at your school. Create 3 separate class files in a project folder; declare variables at the class level; create and use a one-dimensional (1D) array typed as the Team class so it can contain team objects; use the for loop to populate the array and extract data from the array; and code multiple methods.
1. Download the Creating Projects in DrJava PDF (instructors version) on how to create a project folder that manages multiple .java files stored in the same folder. The project folder has the same name as the group .java file. You are creating 3 separate .java files to be stored in the project folder:
2. The main() will instantiate (create) an object of the TeamStats class and use that object to call start(). Make sure you exit main().
3. The TeamStats class will have 4 methods: an empty constructor, start(), processWinsLosses(), and displayTeamsStats(). There are NO value-returning and/or value-receiving methods in the TeamStats class. You will create a 1D array called myTeams at the class level as a null array. The type for this array will be Team.
4. The Team class will have the set methods to capture the team information and the get methods to return the captured data
5. Code at the class level only those variables that need to be used by more than one method.
6. Develop your code by planning the logic first. You will only pseudocode the plan for the Team class. The plan is worth 10% of your grade. Save your plan as GroupMembersLastNamesSecNoPA4Plan. Download the plan instructions and the plan template through the links posted for this assignment on Blackboard. There is an example of a PA4 plan on Blackboard. Use that to assist with your plan.
7. Please work in groups of only two from the same section. The group will only submit one plan and one project with all the files. This means only one of the group members can submit the PA. I will ignore all submissions if both group members post submissions. The project folder and the main() file will reflect the last names of both group members. E.g., CosbyHuxtable001PA4. Through line and method comments, group members will claim authorship and the work has to be evenly distributed. Example:
int age = 0; //By Bill Cosby: STORES AN AGE
/**
*By Cliff Huxtable
*main() captures a first and last name, an age, and a zip code.
*It multiplies the age and zip code to get a product.
*Output will be made to the console screen and to a
*GUI window.
*/
WARNING: One group member CANNOT and MUST NOT carry the load for these assignments. All group members have to be actively engaged in developing and writing code to do well on the exams and in Java II.
8. Program Documentation: In your program, YOU MUST insert a program purpose in the first comment box. The content of that first comment box was shown to you in the Anatomy of a Java Program lecture for chapter 1. Use Javadoc comment boxes beginning with /** and ending with */. Insert a Javadoc comment box above each of the methods in each of the programs explaining what is going on. Line comment the import statements and the variables.
PROMPTS: Code the bold from the prompts below in the printf statements that capture data into your program. Once again, the prompts tell you your input variables. Keep in mind that these prompts are not all in the same class.
1st Prompt: Code in start(). The method start() will be the only method from the TeamStats class called by the main()
Do you want to track the performance of the athletic teams at your school? Enter 'Y' or 'N':
If the answer to the above question is "N" display the following message:
Thank you! Exiting program.
If the answer is "Y" then proceed to prompts 2 through 7.
2nd Prompt: Code in processWinsLosses().
What is the name of your school?
3rd Prompt: Code in processWinsLosses(). The value captured here is the size of the array called myTeams.
How many athletic teams do you have at your school?
4th Prompt: Code in setTeam().
Enter the team type:
5th Prompt: Code in setCoach().
Enter the name of the coach:
6th Prompt: Code in setTotalGames(). The Xs represent the type of the team (basketball, football, etc.). Note the team type is all lowercase.
Enter the total number of games played for the xxxxxxxxxxxx team:
7th Prompt: Code in setWins(). The Xs represent the type of the team.
Enter the number of wins for the xxxxxxxxxxxx team:
FINAL OUTPUT SPECIFICATIONS: The output will print the header, the team's name, the coach, the total number of games played, the number of wins, the number of losses and the win percent as a decimal. There are multiple teams which is why the output specs are repeated. The number of losses is calculated. The header should be triple-line advanced from the last prompt or output. The printing of the output will be in a method called displayTeamsStats() from the TeamStats class. The Xs in the header is the school name.
TEAMS WIN-LOSS RECORD FOR XXXXXXXXXXXX
Team: Xxxxxxxxxxxx
Coach: Xxxxxxxxxxxx
Total Games: ZZ9
No. of Wins: ZZ9
No. of Losses: ZZ9
Win Percent: Z9.99%
Team: Xxxxxxxxxxxx
Coach: Xxxxxxxxxxxx
Total Games: ZZ9
No. of Wins: ZZ9
No. of Losses: ZZ9
Win Percent: Z9.99%
***END OF OUTPUT SPECIFICATIONS***