subject

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.");
}
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
How can a user open a blank presentation? 1.on the file menu, click new, and then click recent templates 2.on the file menu, click new, and then click blank presentation 3. on the view menu, click templates, and then click recent templates 4. on the view menu, click samples, and then click blank presentation
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
What is the foundation for proper monitoring, load balancing and routing in distributed systems
Answers: 3
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Spoons are designed to be used for: spring hammering. applying body filler. identifying high and low spots. sanding highly formed areas.
Answers: 3
You know the right answer?
7.25. LAB: Winning team (classes)
Given main(), define the Team class (in file Team. java). Fo...
Questions
question
Social Studies, 24.03.2021 19:00
question
Social Studies, 24.03.2021 19:00
question
History, 24.03.2021 19:00
question
Mathematics, 24.03.2021 19:00
Questions on the website: 13722363