Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java 3. (10 points) Code Refactoring- The code below represents a fictitious Thing that tion, a num- mbies (totally made up), and a list of

Java
image text in transcribed
3. (10 points) Code Refactoring- The code below represents a fictitious Thing that tion, a num- mbies (totally made up), and a list of images. Carefully refactor the code without introducing y new classes, but to conform to the design specifications you have been learning this quarter. To save time, edit the existing classes below. Feel free to cross things out, draw arrows, etc. public class Thing f pubiie point 1ocation piiblic nt numzoombies ; public ArrayList pics: public Thing (Point location, int numZoombies) t num2 :-X this.location location: this.numZoombies = numZoombies; pics new ArrayList // space to maybe add code? Pie (int ndax) blie void public class Utilt public statse PImage getpic (Thing thing, int index) t return thing.pics/get (index); public static void getcloseTo (Thing thing1, Thing thing2) thing1.logation.move (thing2.location.x, thing2.location.y) public elass UseThings t public static void main (Stringt] args) f Thing julie new Thing (new Point (1,2), 7) Thing cookie = new Thing (new Point (-7, 15, 4); uylie vpri.getcloseTo(cookie) System.out.println("1oc:*+ gulie location) : more code here that is not shown

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