Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String execute(String cmd) {
- List<String> lista = this.getNames();
- String [] exec = cmd.split("\\ ");
- Double z;
- for (String i : lista) {
- if (exec.length == 3 && exec[0].equals(i)) {
- Double x = Double.parseDouble(exec[1]);
- Double y = Double.parseDouble(exec[2]);
- z = Math.pow(x,y);
- return z.toString();
- }
- }
- throw new IllegalArgumentException();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement