Merge pull request 'Speak Methode implementiert' (#1) from Sortierung_In_String into main
Reviewed-on: #1Exceptions
commit
0bead4f860
|
@ -1,5 +1,7 @@
|
|||
package domain;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import exceptions.RobotException;
|
||||
import roboterSystem.Robot;
|
||||
|
||||
|
@ -48,8 +50,21 @@ public abstract class Robotermodell implements Robot {
|
|||
|
||||
@Override
|
||||
public String speak(int[] zahlen) throws RobotException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
String hilfszeichen;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (this instanceof C3PO) {
|
||||
hilfszeichen = ";";
|
||||
} else {
|
||||
hilfszeichen = ",";
|
||||
}
|
||||
|
||||
Arrays.stream(zahlen)
|
||||
.forEach(z -> sb.append(z + hilfszeichen + " "));
|
||||
|
||||
sb.setLength(sb.length() - 2);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue