Question: In method readRGBComponent, ignore using an input box. Thank You. Problem 1 (9 points). Color conversion. Several different formats are used to represent color. For
Problem 1 (9 points). Color conversion. Several different formats are used to represent color. For example, the primary format for LCD displays, digital cameras, and Web pages, known as RGB format, specifies the level of red (R), green (G), and blue (B) on an Integer scale from O to 255. The primary format for publishing books and magazines, known as CMYK format, specffies the level of cyan (C) magenta (M], yellow M, and black (K) on a real scale from 0.0 to 1.0. Write a program RGBtoCMYK that converts RGB to CMYK. Your program will read three Integers-red, green, and blue from the user convert them to CMYK values, and display the result. The formulas for converting from RGB to CMYK are: green bl w max 2ss' 255 255 cyan magenta- W- yellow black = 1-w You will need to implement the following methods: publie statie int readRGBComponent (String message) o Reads one of the the RGB components using input dialog box. You will need to call this method for each component with the appropriate message . public static double getMax (int red, int green, int blue) 1ed green e o Returns the maximum of the three values o Hint: notice that this method only takes in the red, green, and blue values. This means public static double getcyan (int red, int green, int blue) public static double getKagenta (int red, int green, int blue) public static double getYellow(int red, int green, int blue) that the division by 255 happens inside the getMax method. o Calculates and returns the cyan component. o Calculates and returns the magenta component. o Calculates and returns the yellow component o Calculates and returns the black component * public static double getBlack (int red, int green, int blue) pub1ic static void displayCHYK (double cyan, double magenta, double yellow,: double black) Displays the cyan, magente, yellow, and black components using a messoge box
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
