Question: Write a java program to create a class called TotalGoalsScored that represents the total number of goals scored by a football team. The TotalGoals Scored

Write a java program to create a class called TotalGoalsScored that represents the total number of goals scored by a football team. The TotalGoals Scored class should contain a single integer as instance data, representing the number of goals scored. Write a constructor to initialize the number of goals to zero. Write a method called setGoal that increments the value by one whenever a goal is scored, and another method called getGoal that returns the total number of goals scored so far. Finally, create a driver class called GoalTracker that creates a few TotalGoals Scored objects and tests their methods. a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
