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, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
question
Computers and Technology, 24.06.2019 12:10
What is it called during the editing process when the processor ensures that a character holding a coffee mug from one angle is holding the same mug in the same way when the shot switches to another camera at another angle? cinematography continuity technology prop use
Answers: 1
question
Computers and Technology, 24.06.2019 17: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
Answers: 2
question
Computers and Technology, 24.06.2019 19:00
Luis is cloud-based( microsoft bot framework). true false
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
History, 12.03.2021 22:30
question
Mathematics, 12.03.2021 22:30
question
Mathematics, 12.03.2021 22:30
question
Biology, 12.03.2021 22:30
question
Mathematics, 12.03.2021 22:30
Questions on the website: 13722363