Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(b) The Java code below illustrates how a Drawing object may be composed of another Drawing object and Shape objects such as a Circle. Using
(b) The Java code below illustrates how a Drawing object may be composed of another Drawing object and Shape objects such as a Circle. Using an appropriate Design Pattern as your guide, write the remaining code that would be required to make this code run to produce the output shown below.
can i get an answer that includes the class and all the code in which this particular question is contained
(b) The Java code below illustrates how a Drawing object may be composed of another Drawing object and Shape objects such as a Circle. Using an appropriate Design remaining code that would be required to make this code run to produce the output shown below (c) Refactor your code so that the setColour method will throw an exception if it receives a parameter value other than Green", "white" or "Gold". The method should not be case-sensitive either, so "green", "white" or gold" should be acceptable. Show how you handle the exception. Pattern as your guide, write the public static void main(String args) Shape tril new TriangleO Shape tri2 = new Triangle(); Shape cir1 new Circle(); Drawing drawing = new Drawing(); Drawing drawing2 new Drawing(); Drawing drawing3-new DrawingO; drawing3.add(tri2); drawing2.add(tri); drawing2.add(drawing3); drawing1.add(cirl); drawing1.add(drawing2); drawing1.setColourC"Green drawing2.setColourC"White drawing3.setColourC"Gold; drawing1.printO; Output Drawing Circle with color Green Drawing Triangle with color White Drawing Triangle with color GoldStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started