Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like help making UML diagrams for the following code : import java.util.*; abstract class SpaceShip{ int numEngines; String name; abstract void ShowSpeed(); }

I would like help making UML diagrams for the following code :

import java.util.*;

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions

Question

9. How does one identify the essential functions of a job?

Answered: 1 week ago