In: Computer Science
very urgent!! need it in less than an hour !!!please anyone:::Convert the following UML diagram into the Java code. Write constructor, mutator and accessor methods for the given class. Create an instance of the class in a main method using a Practice class.
player
name:string
level: int
ext:float
money:float
//Player.java public class Player { private String name; private int level; private float ext; private float money; public Player(String name, int level, float ext, float money) { this.name = name; this.level = level; this.ext = ext; this.money = money; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public float getExt() { return ext; } public void setExt(float ext) { this.ext = ext; } public float getMoney() { return money; } public void setMoney(float money) { this.money = money; } }
////////////////////////////////////////////////////////////////////////////
//Practice.java public class Practice { public static void main(String[] args) { Player p = new Player("ronaldo",1,5,123); System.out.println(p.getName()); System.out.println(p.getLevel()); System.out.println(p.getExt()); System.out.println(p.getMoney()); } }