package athlete; public class Athlete { String name, gender; double age, rank, noOfEventParticipanted; public Athlete(String name, String gender, int age, int rank, int noOfEventParticipant) { this.name = name; this.gender = gender; this.age = age; this.rank = rank; this.noOfEventParticipanted = noOfEventParticipant; } void participantInEvent(int position, boolean isNewRecord){ if(position ==1) rank++; else if(position == 2) rank+=0.5; else if(position ==3) rank+=0.25; if(isNewRecord) rank+=0.5; } public double getRank() { return rank; } public double getNoOfEventParticipanted() { return noOfEventParticipanted; } public void display() { System.out.println(name+" "+age+" "+rank); } } class TestAthlete{ public static void main(String[] args) { Athlete a = new Athlete("rahim","male",17,73,75); a.participantInEvent(1, false); System.out.println(a.getRank()); a.display(); } }