Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using this information: import java.util.ArrayList; import java.util.Scanner; class Height { private final int feet; private final int inches; public Height ( int feet, int inches
Using this information: import java.util.ArrayList;
import java.util.Scanner;
class Height
private final int feet;
private final int inches;
public Heightint feet, int inches
this.feet feet;
this.inches inches;
public int toInches
return feet inches;
@Override
public String toString
int normalizedInches inches ;
return String.formatdd feet, normalizedInches;
class Player
private final String name;
private final Height height;
private final int age;
public PlayerString name, Height height, int age
this.name name;
this.height height;
this.age age;
public String getName
return name;
public Height getHeight
return height;
public int getAge
return age;
@Override
public String toString
return String.formatName: s Height: s Age: d name, height.toString age;
public class Project
public static void mainString args
Scanner scanner new ScannerSystemin;
ArrayList players new ArrayList;
int totalAge ;
System.out.printlnEnter player information type 'done' to finish:;
while true
System.out.printName: ;
String name scanner.nextLine;
if nameequalsIgnoreCasedone
break;
System.out.printHeight feet: ;
int feet scanner.nextInt;
System.out.printHeight inches: ;
int inches scanner.nextInt;
scanner.nextLine; Consume the newline character
System.out.printAge: ;
int age scanner.nextInt;
scanner.nextLine; Consume the newline character
Height height new Heightfeet inches;
Player player new Playername height, age;
players.addplayer;
totalAge age;
if players.isEmpty
double averageAge double totalAge players.size;
System.out.printlnAverage Age of Players: averageAge;
Player tallestPlayer findTallestPlayerplayers averageAge;
System.out.printlnTallest Player: tallestPlayer.toString;
else
System.out.printlnNo player information entered.";
private static Player findTallestPlayerArrayList players, double averageAge
Player tallestPlayer null;
int maxHeight ;
for Player player : players
if playergetAge averageAge
int totalHeight player.getHeighttoInches;
if totalHeight maxHeight
maxHeight totalHeight;
tallestPlayer player;
return tallestPlayer;
write a A UML class diagram that includes all classes you wrote. Do not include
predefined classes.
b A test plan that includes test cases that you have created indicating what aspects
of the program each one is testing
c A short paragraph on lessons learned from the project
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started