/* A robot is defined by: its name (e.g. "XJ47" or "Bumblebee"), its power-level (47 or 850), what shape it can transform into (a toaster, or a VW Beetle), whether it is currently transformed (true or false), and whether it's evil (false or true). - Make a constructor (using, for now, the same boilerplate pattern as we did for Song). - Make a `void testAll()`, which for now just has 2-3 examples of Robot objects. - write a function: currentShape: takes in a Robot, returns its current shape, (either "Robot" or its transfromed shape, depending on whether it's currently transformed.) Note: name your parameter `thiss`. - write a function: strongerOf, which takes in two Robots, and returns the one that has a higher power-level. (In case of a tie, use the first one). - write a function `toString` that takes in a robot, and returns either "The autobot Bumblebee!" (use "autobot" for non-evil, and "decepticon" for evil) "a regular-looking toaster." */ class Robot2 extends Object120 { String name; int power; String shape; boolean isTransformed; boolean isEvil; Robot2( String n, int p, String s, boolean isT, boolean isE ) { super(n,p,s,isT,isE); } String currentShape( /* Robot2 this */ ) { if (this.isTransformed) { return "A regular-looking " + this.shape + "."; } else { return "The " + (this.isEvil ? "decepticon" : "autobot") + " " + this.name + "!"; } } void testAll() { Robot2 r2 = new Robot2("R2D2", 7, "trashbin", false, false); Robot2 r3 = new Robot2("Maria", 101, "woman", false, true); // https://en.wikipedia.org/wiki/Maschinenmensch Robot2 op = new Robot2("Optimus Prime", 835, "tractor-trailer", true, false); Robot2 mg = new Robot2("Megatron", 835, "laser cannon", true, false); assertEquals( r2.currentShape(), "The autobot R2D2!" ); assertEquals( r3.currentShape(), "The decepticon Maria!" ); assertEquals( op.currentShape(), "A regular-looking tractor-trailer." ); assertEquals( mg.currentShape(), "A regular-looking laser cannon." ); } }