Computers and Technology
Computers and Technology, 16.04.2020 05:17, xjdjsisi

7.25. LAB: Winning team (classes)
Given main(), define the Team class (in file Team. java). For class method getWinPercentage(), the formula is: teamWins / (teamWins + teamLosses)
Note: Use casting to prevent integer division.
Ex: If the input is:
Ravens
13
3
where Ravens is the team's name, 13 is number of team wins, and 3 is the number of team losses, the output is:
Congratulations, Team Ravens has a winning average!
If the input is Angels 80 82, the output is:
Team Angels has a losing average.
//Team. java file
public class Team {
// TODO: Declare private fields - teamName, teamWins, teamLosses
private String teamName;
private int teamWins;
private int teamLosses;

// TODO: Define mutator methods -
// setTeamName(), setTeamWins(), setTeamLosses()
// TODO: Define accessor methods -
// getTeamName(), getTeamWins(), getTeamLosses()
// TODO: Define getWinPercentage()
}
//WinningTeam. java file
import java. util. Scanner;

public class WinningTeam {
public static void main(String[] args) {
Scanner scnr = new Scanner(System. in);

Team team = new Team();

String name = scnr. next();
int wins = scnr. nextInt();
int losses = scnr. nextInt();

team. setTeamName(name);
team. setTeamWins(wins);
team. setTeamLosses(losses);

if (team. getWinPercentage() >= 0.5) {
System. out. println("Congratulations, Team " + team. getTeamName() +
" has a winning average!");
}
else {
System. out. println("Team " + team. getTeamName() +
" has a losing average.");
}
}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:00, GGerardi7552
What are procedures that keep a data base current
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, vane3152
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, ishmael9332
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
image
Computers and Technology, 24.06.2019 09:10, daedae11142
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
Do you know the correct answer?
7.25. LAB: Winning team (classes)
Given main(), define the Team class (in file Team. java). Fo...

Questions in other subjects:

Konu
Mathematics, 17.04.2020 18:15
Konu
Mathematics, 17.04.2020 18:15