CODE IN JAVA PLEASE, THANK YOU.
***THIS IS THE 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.setName(name);
team.setWins(wins);
team.setLosses(losses);
team.printStanding();
}
}
7.25 LAB: Winning team (classes) 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. 300766.2211204.pazzy7 LAB ACTIVITY 7.25.1: LAB: Winning team (classes) 1 public class Team 2 // TODO: Declare private fields 3 4 5 // TODO: Define mutator methods - 6 7 8 9 // TODO: Define accessor methods - 10 11 12 HAMASOMAGONE Current file: Team.java ▾ name, wins, Losses setName(), setwins (), setLosses () getName(), getwins (), getLosses () 0/10 Load default template...
CODE IN JAVA PLEASE, THANK YOU. ***THIS IS THE WINNINGTEAM.JAVA FILE*** import java.util.Scanner; public class WinningTe
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am