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 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
What is the next step if your volume does not work on computer
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
Does anyone have the problem where you try to watch a video to get your answer but it brings up a thing asking your gender to make ads relevant but it doesn't load? btw i won't be able to see the answer so use the comments .
Answers: 1
question
Computers and Technology, 25.06.2019 07:00
Quick styles allow you to format an entire document quickly? t/f
Answers: 1
You know the right answer?
7.25. LAB: Winning team (classes)
Given main(), define the Team class (in file Team. java). Fo...
Questions
question
Biology, 18.05.2020 04:57
question
Health, 18.05.2020 04:57
Questions on the website: 13722361