I am trying to implement the UML below using Java:
I have successfully implemented every instruction except one which is:
Theater class:
- Override the showArea method and display the size multiply by 12.
I am new to UML and from my understanding, I am not allowed to create constructors in any of the classes. This is confusing since I don't know where I can define the size for showArea.
Below is the working code I have right now.
Place Class
public abstract class Place { private String placeName; private int capacity; private String placeDescription; private int workingHours; public abstract void showEvents(); } Building Class
public abstract class Building extends Place{ public abstract void showArea(); } Theater Class
public class Theater extends Building{ @Override public void showArea() { System.out.println("Theater area : " ); } @Override public void showEvents() { System.out.println("Events ready to be hosted !!"); } } Main class
public class CodingtonDemo { public static void main(String[] args) { Theater theater = new Theater(); theater.showArea(); theater.showEvents(); } } Expected result in console:
Theater area : 6000
Events ready to be hosted !!
My result so far:
Theater area : [No value yet]
Events ready to be hosted !!
https://stackoverflow.com/questions/65526838/how-do-i-strictly-implement-the-given-uml-using-java January 01, 2021 at 10:05AM
没有评论:
发表评论