It's for an assignment in my Intro to Comp Prog. so I'm definitely a beginner. Here's the assignment, I've been working on it for over a week, and it seems like it would be simple, but I cannot figure it out..
it's an assignment in DrJava, HERE IT IS:
Define a class named PhotoOps. Like you did in your last programming assignment,
define the class with a String instance variable named _filename, and Picture
instance variable named _picture. Define the constructor so that it accepts a String
as an argument; the String passed in should be the name of a file in the
/eng/class/notes/cse113/intro-prog-java/mediasources/
directory. Assign to _filename the result of combining the String
�/eng/class/notes/cse113/intro-prog-java/mediasources/� with
the constructor�s String parameter, using �+� to concatenate the two Strings.
(this is the part I can't really figure out)
Now onto the new part of this programming 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.
HERE'S WHAT I HAVE SO FAR
AND THE ERRORS I'M GETTING
any help on how I can correct the errors, and complete the assignment would be EXTREMELY appreciated! thanks in advance
it's an assignment in DrJava, HERE IT IS:
Define a class named PhotoOps. Like you did in your last programming assignment,
define the class with a String instance variable named _filename, and Picture
instance variable named _picture. Define the constructor so that it accepts a String
as an argument; the String passed in should be the name of a file in the
/eng/class/notes/cse113/intro-prog-java/mediasources/
directory. Assign to _filename the result of combining the String
�/eng/class/notes/cse113/intro-prog-java/mediasources/� with
the constructor�s String parameter, using �+� to concatenate the two Strings.
(this is the part I can't really figure out)
Now onto the new part of this programming 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.
HERE'S WHAT I HAVE SO FAR
AND THE ERRORS I'M GETTING
any help on how I can correct the errors, and complete the assignment would be EXTREMELY appreciated! thanks in advance