jeudi 11 avril 2019

Abstract Methods [on hold]

I am quite a beginner in java field,planning to migrate from Mainframes . As part of my exercise got a question. Experts could you please help me to solve this.

There is a Shape class implemented with an abstract method, drawShape(), to print shapes.Need to complete one class like Circle and ShapeFactory. class circle has a method drawShape() to print "drawing a Circle" and the class ShapeFactory has a method drawshape() that takes as parameter a string and calls the corresponding drawShape() method based on string type. if an invalid shape is requested, it should print "not supported"where [shape string] is replaced with the offending string.

input: 2 circle square

output: Drawing a circle Drawing square is not supported.

Aucun commentaire:

Enregistrer un commentaire