Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is: wins / (wins + losses). Note: Use casting to prevent integer division. For class method printStanding(), output the win percentage of the team with two digits after the decimal point and whether the team has a winning or losing average. A team has a winning average if the win percentage is 0.5 or greater. Ex: If the input is: Ravens 13 where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is: Win percentage: 0.81 Congratulations, Team Ravens has a winning average! Ex: If the input is: Angels 80 82 the output is: Win percentage: 0.49 Team Angels has a losing average.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:
wins / (wins + losses). Note: Use casting to prevent integer division.
For class method printStanding(), output the win percentage of the team with two digits after the decimal point and whether the team has a
winning or losing average. A team has a winning average if the win percentage is 0.5 or greater.
Ex: If the input is:
Ravens
13
3
where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is:
Win percentage: 0.81
Congratulations, Team Ravens has a winning average!
Ex: If the input is:
Angels
80
82
the output is:
Win percentage:
0.49
Team Angels has a losing average.
Transcribed Image Text:Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is: wins / (wins + losses). Note: Use casting to prevent integer division. For class method printStanding(), output the win percentage of the team with two digits after the decimal point and whether the team has a winning or losing average. A team has a winning average if the win percentage is 0.5 or greater. Ex: If the input is: Ravens 13 3 where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is: Win percentage: 0.81 Congratulations, Team Ravens has a winning average! Ex: If the input is: Angels 80 82 the output is: Win percentage: 0.49 Team Angels has a losing average.
Current file: Team.java
Load default template...
1 public class Team {
// TODO: Declare private fields - name, wins, losses
2
3
4
5
// TODO: Define mutator methods
//
setName(), setWins(), setLosses()
7
8
// TODO: Define accessor methods
//
9.
10
getName(), getWins(), getLosses()
11
12
13
// TODO: Define getWinPercentage()
14
15
16
// TODO: Define printStanding()
Transcribed Image Text:Current file: Team.java Load default template... 1 public class Team { // TODO: Declare private fields - name, wins, losses 2 3 4 5 // TODO: Define mutator methods // setName(), setWins(), setLosses() 7 8 // TODO: Define accessor methods // 9. 10 getName(), getWins(), getLosses() 11 12 13 // TODO: Define getWinPercentage() 14 15 16 // TODO: Define printStanding()
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Adjacency Matrix
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT