Question

In: Computer Science

very urgent!! need it in less than an hour !!!please anyone:::Convert the following UML diagram into...

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

Solutions

Expert Solution


//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());
    }
}


Related Solutions

Convert the following UML diagram into the Java code. Write constructor, mutator and accessor methods for...
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. Note: The structure of the class can be compiled and tested without having bodies for the methods. Just be sure to put in dummy return values for methods that have a return type other than void.      
Can anyone please explain this table for me please. I need it very badly. thanks The...
Can anyone please explain this table for me please. I need it very badly. thanks The 95% confidence intervals for the student using cannabis in the last 12 months is as follows: Point Estimate Upper Limit Lower Limit Male 0.27 0.05 Female 0.35 0.09 Total 0.28 0.10
Please answer in less than an hour :) Can you explain and show how we get...
Please answer in less than an hour :) Can you explain and show how we get the Specific Cutting pressure in GPa if vertical force is 0.882 kN, feed rate is .0508 mm/rev, and depth of the cut is 1.8161 mm.  
<<<<<<<<. I need the UML diagram for all classes.java below. >>>>> // Vehicle.java public class Vehicle...
<<<<<<<<. I need the UML diagram for all classes.java below. >>>>> // Vehicle.java public class Vehicle {    // data members declared as private    private String make;    private double weight;    private double height;    private double length;    private int maxSpeed;    private int noOfDoors;    private int numberSeats;    /**    * @param make    * @param weight    * @param height    * @param length    * @param maxSpeed    * @param noOfDoors    *...
CAN ANYONE ASSIST ME PLEASE URGENT : Suppose that the current spot exchange rate is €/£...
CAN ANYONE ASSIST ME PLEASE URGENT : Suppose that the current spot exchange rate is €/£ 1.50/52 and the one-year forward exchange rate is €1.60/64₤. The one-year interest rate is 5.4% in euros and 5.2% in pounds. You can borrow at €1,000,000 or the equivalent pound at the current spot exchange rate. Which country’s money market you decide to invest? Why? Calculate the amount of arbitrage profit and loss in €? Bid-Ask Prices? How to solve??
urgent need it an hour wil rate The comparative balance sheets of Posner Company, for Years...
urgent need it an hour wil rate The comparative balance sheets of Posner Company, for Years 1 and 2 ended December 31, appear below in condensed form. 1 Year 2 Year 1 2 Cash $53,000.00 $50,000.00 3 Accounts Receivable (net) 37,000.00 48,000.00 4 Inventories 108,500.00 100,000.00 5 Investments 70,000.00 6 Equipment 573,200.00 450,000.00 7 Accumulated Depreciation-Equipment (142,000.00) (176,000.00) 8 $629,700.00 $542,000.00 9 Accounts Payable $62,500.00 $43,800.00 10 Bonds Payable, Due Year 2 100,000.00 11 Common Stock, $10 par 325,000.00 285,000.00...
In no less than 200 words, discuss: Is it likely expensive to convert a firm to...
In no less than 200 words, discuss: Is it likely expensive to convert a firm to practices that are in full Corporate Social Responsibility (CSR) compliance?
Please perform reverse engineering to compose a UML class diagram for the provided java code /*...
Please perform reverse engineering to compose a UML class diagram for the provided java code /* Encapsulated family of Algorithms * Interface and its implementations */ public interface IBrakeBehavior { public void brake(); } public class BrakeWithABS implements IBrakeBehavior { public void brake() { System.out.println("Brake with ABS applied"); } } public class Brake implements IBrakeBehavior { public void brake() { System.out.println("Simple Brake applied"); } } /* Client that can use the algorithms above interchangeably */ public abstract class Car {...
Draw the diagram (ER / MR / UML) for a database containing the following characteristics: •...
Draw the diagram (ER / MR / UML) for a database containing the following characteristics: • Presence sensor that stores presence information with its timestamp and its location. • Distance sensor that saves distance information with its timestamp and its location. • An actuator of a switch that energizes a bulb, where the record of its been with your timestamp and your location. • An actuator of a motor that opens a door, where the record of its been with...
In no less than 200 words, discuss: Is it typically time consuming to convert a firm...
In no less than 200 words, discuss: Is it typically time consuming to convert a firm to practices that are in full Corporate Social Responsibility (CSR) compliance?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT