Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a UML class and sequnce diagram for the following code: 1. public abstract class Dog { protected String name; protected Dog (String name)

I need a UML class and sequnce diagram for the following code:

1. public abstract class Dog { protected String name; protected Dog (String name) { this.name = name; } public String getName() { return name; } public String speak() { return "Woof"; } public abstract int avgBreedWeight(); }

2. public class Labrador extends Dog { private String color; private int breedWeight = 75; public Labrador(String name, String color) { super(name); this.color = color; } public String speak() { return "WOOF"; } public int avgBreedWeight() { return breedWeight; } }

3. public class Yorkshire extends Dog { private String color; private int breedWeight =75; public Yorkshire(String name, String color) { super(name); this.color = color; } public String speak() { return "woof"; } public int avgBreedWeight() { return breedWeight; } }

4. public class DogTest { public static void main(String args[]) { Dog objLabrador = new Labrador("Franz","chocolate"); Dog objYorkshire = new Yorkshire ("Quatro","Black"); System.out.println(objLabrador.name + " says " + objLabrador.speak()); System.out.println("The average weight of a Labrador is " + objLabrador.avgBreedWeight()); System.out.println(objYorkshire.name + " says " + objYorkshire.speak()); System.out.println("The average weight of a Yorkshire is " + objYorkshire.avgBreedWeight()); } }

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

More Books

Students also viewed these Databases questions

Question

What is Working Capital ? Explain its types.

Answered: 1 week ago