Question: 4. For each of the following Java methods, state whether or not it meets the definition of a function with domain and codomain Color. If

 4. For each of the following Java methods, state whether or

4. For each of the following Java methods, state whether or not it meets the definition of a function with domain and codomain Color. If not, state the reason why. a. /** * Returns a new Color that is the negative of the given Color public static Color negative (Color c) { return new Color(255 - C.red, 255 - c.green, 255 - c.blue) * Returns a new Color that grayscales' the given Color by averaging its rgb values public static Color grayscale(color c) { int average = (c.red + c.green + c.blue) / 3; return new Color (average, average, average); * Returns a new Color with the same green and blue values * as the given color, but with a red value entered by the user public static Color setRed(Color c) { int newRed; // read in a value from the user to use as the new red value try (Scanner in = new Scanner(System.in)) { System.out.println("Enter a new red value: "); newRed = in.nextInt(); return new Color (newRed, c.green, c.blue)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!