Write a class that will represent a football team in a package called football. i) We want to be able to access the clas
Posted: Wed Apr 27, 2022 3:46 pm
Write a class that will represent a football team in a package called football.
i) We want to be able to access the class Football team from any package.
Add fields for the following properties, which cannot be accessed outside of the class.
name of the team
number of wins
number of losses
ii) write a constructor that accepts the name of the team, the number of wins and the number of losses as arguments and sets the class properties to those values. This constructor should be accessible from any package.
iii) write the methods that return the name of the team, the number of losses and the number of wins. These methods should be accessible from any package.
iv) Finally add a main method of the football team class. In the main method, construct a footballteam named "AITI" with 3 wins and 5 losses. Call the method that returns true when the team has a good record and print out the result. Now make three calls to the method that increases the number of wins by 1.Lastly, call the "good record" method again and print out the result.
i) We want to be able to access the class Football team from any package.
Add fields for the following properties, which cannot be accessed outside of the class.
name of the team
number of wins
number of losses
ii) write a constructor that accepts the name of the team, the number of wins and the number of losses as arguments and sets the class properties to those values. This constructor should be accessible from any package.
iii) write the methods that return the name of the team, the number of losses and the number of wins. These methods should be accessible from any package.
iv) Finally add a main method of the football team class. In the main method, construct a footballteam named "AITI" with 3 wins and 5 losses. Call the method that returns true when the team has a good record and print out the result. Now make three calls to the method that increases the number of wins by 1.Lastly, call the "good record" method again and print out the result.