![]() |
| ||
| getting errors in java for an assignment ASSIGNMENT: In section 6.1 of the text, the authors explain how to compute the distance between two colors. They write, The Pixel class has an object method colorDistance(Color color) which returns the distance between the color in the current Pixel object and the passed color. Write a method which takes three arguments, a Color, targetColor, and an int, distance, and a second Color, newColor. Define the method so that it changes the color each Pixel in _picture that is within distance of the targetColor to newColor. Now experiment with this method and the redMotorcycle.jpg picture to find a good value for the distance from java.awt.Color.RED which will change the color of the motorcycle’s red parts to java.awt.Color.WHITE. Write the value you think works best into a comment for the method you wrote. WHAT I HAVE SO FAR: import java.awt.Color; ERRORS I'M GETTING: 2 errors found: File: /Users/jsmith/Desktop/drjava-stable-20050814-2234-osx/CSE113/PhotoOps.java [line: 16] Error: cannot find symbol symbol : method newColor(Pixel) location: class PhotoOps File: /Users/jsmith/Desktop/drjava-stable-20050814-2234-osx/CSE113/PhotoOps.java [line: 17] Error: cannot find symbol symbol : method targetColor(Pixel) location: class PhotoOps any help would be greatly appreciated! thanks |
| ||
| Re: getting errors in java for an assignment You still need to create the public Color newColor(Pixel pixel) method that you are attempting to use. |
| ||
| Re: getting errors in java for an assignment where would that go? i put it here public Color newColor(Pixel pixel); and it must be wrong because i'm getting an error |
| ||
| Re: getting errors in java for an assignment Because all you've done is declare the method, you also need to define it. That method needs to actually do something. |
| ||
| Re: getting errors in java for an assignment This gets so confusing to me so sorry if I ask stupid questions..but where and how do I define the method? |
| All times are GMT -4. The time now is 11:02 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC