Anonymous Anonymous - 1 month ago
710 0

No description

Java

WaterpoloPlayer.java

public class WaterpoloPlayer
{
    private int goals;
    private int shots;
    private String name;
    
    public WaterpoloPlayer(String theName, int theGoals, int theShots)
    {
        name = theName;
        goals = theGoals;
        shots = theShots;
    }
    
    public String toString()
    {
        return name + ": " + goals + "/" + shots;
    }
    
    public double getShotAverage()
    {
       return (double) (goals / shots);

    }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download