Question: Please create a UML diagram from this Javascript ---------------------------------------------------- abstract class SpaceShip{ int numEngines; String name; abstract void ShowSpeed(); } class ScoutShip extends SpaceShip{ ScoutShip(){
Please create a UML diagram from this Javascript ---------------------------------------------------- abstract class SpaceShip{ int numEngines; String name; abstract void ShowSpeed(); } class ScoutShip extends SpaceShip{ ScoutShip(){ this.numEngines = 1; this.name = "Scout"; } ScoutShip(int numEngines){ this.numEngines = numEngines; this.name = "Scout"; } public void ShowSpeed(){ int speed = numEngines*2; System.out.printf("%s ship can fly at speed %d warp factor ",this.name,speed); } } class ExplorerShip extends SpaceShip{ ExplorerShip(){ this.numEngines = 2; this.name = "Explorer"; } ExplorerShip(int numEngines){ this.numEngines = numEngines; this.name = "Explorer"; } public void ShowSpeed(){ int speed = numEngines*2; System.out.printf("%s ship can fly at speed %d warp factor ",this.name,speed); } } class TestShip { public static void main(String[] args) { ScoutShip scoutship = new ScoutShip(); ExplorerShip explorership = new ExplorerShip(3); scoutship.ShowSpeed(); explorership.ShowSpeed(); } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
