Pr_robot_factory/Main.java

68 lines
1.7 KiB
Java
Raw Normal View History

import domain.*;
2022-12-14 09:54:18 +01:00
import robot.exceptions.RobotException;
2022-12-08 14:46:33 +01:00
public class Main {
public static void main(String[] args) {
int[] input = {42,6,5,4,3,43,1};
2022-12-14 09:54:18 +01:00
int[] input2 = input;
C3PO Herbert = new C3PO(1, "Herbert");
R2D2 Herb = new R2D2(0, "Herb");
int[] input3 = {};
2022-12-14 09:54:18 +01:00
//Herbert.triggerPowerSwitch();
// Herb.triggerPowerSwitch();
// try{
// String sorted = Herb.speak(input);
// System.out.println(sorted);
// } catch (RobotException re) {
// System.out.println(re);
// }
try{
int[] sorted = Herb.think(input);
for(int i = 0; i < sorted.length; i++){
System.out.print(" " + sorted[i]);
}
}catch(RobotException re){
2022-12-25 19:57:20 +01:00
re.printStackTrace();
}
2022-12-25 19:57:20 +01:00
System.out.println("last exception thrown");
String re = Herb.getLastException().toString();
System.out.println(re);
Herb.triggerPowerSwitch();
2022-12-14 10:18:36 +01:00
try{
int[] sorted = Herb.think(input);
for(int i = 0; i < sorted.length; i++){
System.out.print(" " + sorted[i]);
}
}catch(RobotException e){
2022-12-25 19:57:20 +01:00
e.getLocalizedMessage();
}
2022-12-25 19:57:20 +01:00
System.out.println("last exception thrown");
re = Herb.getLastException().toString();
System.out.println(re);
2022-12-14 09:54:18 +01:00
//System.out.println("Was neues ausgeben");
//just some testing
/*C3PO Herbert = new C3PO(0, "Herbert");
int[] input = {6,5,4,3,2,1};
Herbert.triggerPowerSwitch();
try{
String asString = Herbert.speak(input);
System.out.println(asString);
}catch(RobotException re){
System.out.println(re);
}
2022-12-08 14:46:33 +01:00
*/
2022-12-08 14:46:33 +01:00
}
}