Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, part of my code needs to be fixed. I have provided the tests that my code failed in and the entire code itself. Can

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Hello, part of my code needs to be fixed. I have provided the tests that my code failed in and the entire code itself. Can you please fix it once you have the chance? I really appreciate any help you can provide.

Test 6a: test colorizeTile("red", 0, 0) on a 4x4 tile collage failed. Comment Test 6b: test colorizeTile("blue", 1, 3) on a 4x4 tile collage failed. + Comment Test 6c: test colorizeTile("green", 3, 3) on a 4x4 tile collage failed. Comment Test 6d: test colorizeTile("red", 0, 1) on a 3x3 tile collage failed. + Comment Test 6e: test colorizeTile("blue", 1, 2) on a 3x3 tile collage failed. + Comment Test 6f: test colorizeTile("green", 2, 1) on a 3x3 tile collage failed. + Comment Test 7a: test grayscaleTile(2, 0) on a 3x3 tile collage failed. Comment Test 7b: test grayscaleTile(3, 3) on a 4x4 tile collage failed. Comment File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 8 V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 9 10 11 12 13 14 15 16 import javax.imareig: ImageIoi. import java.awt.*; import java.awt image. BufferedImage: import java.io.File; import java.io.IOException; public class ArtCollage { A // orginal picture private Picture original; 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 // collage picture private Picture collage; // collage Picture has collageDimension x collageDimension tiles private int collageDimension; V SONARLINT RULES > HTML > Java > PHP > Python 17 18 19 2e 21 22 23 12 23 24 25 26 27 28 29 30 31 32 33 34 35 // A tile has tileDimension X tileDimension pixels private int tileDimension; * One-argument Constructor * 1. set default values of collageDimension to 4 and tileDimension to 100 * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension collageDimension x tileDimension*collageDimens where each pixel is black (see all constructors for the Picture class). * 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) o} > JAVA PROJECTS > MAVEN 48 A 004 36 37 * @param filename the image filename Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 00 8:55 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > &s ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... PUTRA 28 29 30 31 32 33 34 35 36 37 38 39 40 41 + 42 * One-argument Constructor * 1. set default values of collageDimension to 4 and tileDimension to 180 * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension*collageDimension x tileDimension collageDimens where each pixel is black (see all constructors for the Picture class). 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) + A * @param filename the image filename 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 43 44 V SONARLINT RULES public ArtCollage (String filename) { collageDimension = 4; tileDimension = 100; original = new Picture(filename); collage = new Picture(tileDimension * collageDimension, tileDimension * collageDimension); for (int tcol = ; tcol HTML > Java > PHP > Python 45 46 . 47 48 49 50 } } 51 52 53 54 55 56 57 o} > JAVA PROJECTS > MAVEN 48 A 004 * Three-arguments Constructor * 1. set default values of collageDimension to cd and tileDimension to td + 2. initializes original with the filename image Ln 197, Col 54 (3 selected) Spaces: 4 VIF- CRLE Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O 0) 9 LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) } V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 2 52 53 54 55 56 57 ro 58 * Three-arguments Constructor * 1. set default values of collageDimension to cd and tileDimension to td * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension collageDimension x tileDimension collageDimens where each pixel is black (see all constructors for the Picture class). * 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) + A 59 68 61 62 63 64 * @param filename the image filename 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 65 66 V SONARLINT RULES 67 68 69 ze > HTML > Java > PHP > Python public Art Collage (String filename, int td, int cd) { this.collageDimension = cd; this.tileDimension = td; original = new Picture(filename); collage = new Picture(tileDimension * collageDimension, tileDimension * collageDimension); for (int tcol = ; tcol JAVA PROJECTS > MAVEN 48 A 004 * Returns the collageDimension instance variable Ln 197, Col 54 (3 selected) Spaces: 4 VIH-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help ArtCollage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > &s ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS x ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 78 79 80 * Returns the collageDimension instance variable + * @return collageDimension +/ 81 82 83 84 85 86 public int getCollageDimension() { return collageDimension; } A 87 88 89 /+ 1 * Returns the tileDimension instance variable V OUTLINE vs ArtCollage original collage collageDimension tileDimension + 1 * * @return tileDimension 90 91 91 92 93 94 public int gettileDimension() { return tileDimension; } V SONARLINT RULES 95 96 97 > HTML > Java > PHP > Python * Returns original instance variable 98 99 100 101 102 + * @return original */ public Picture getoriginalPicture() { return original; } 103 104 105 106 107 /* o} > JAVA PROJECTS > MAVEN 48 A 004 Returns collage instance variable Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... * Returns collage instance variable 106 107 108 109 110 + 111 112 113 + @return collage +/ public Picture getcollagePicture() { return collage; } A 114 115 116 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension + Display the original image * * Assumes that original has been initialized 1 117 118 119 120 public void showOriginalPicture() { original.show(); } V SONARLINT RULES 121 122 123 124 + > HTML > Java > PHP > Python 125 126 127 128 129 130 * Display the collage image * Assumes that collage has been initialized */ public void showcollagePicture() { collage.show(); } 131 132 133 134 135 /* * Replaces the tile at collageCol,collageRow with the image from filename + Tile (0,0) is the upper leftmost tile o} > JAVA PROJECTS > MAVEN 48 A 004 + @param filename image to replace tile Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O ))) LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) * V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... + * Replaces the tile at collageCol, collageRow with the image from filename * Tile (@,e) is the upper leftmost tile 138 131 132 133 120 134 135 136 137 138 139 140 * @param filename image to replace tile * @param collagecol tile column * @param collageRow tile row */ */ public void replaceTile (String filename, int collagecol, int collageRow) { Picture source2 = new Picture(filename); A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 V SONARLINT RULES 141 142 143 144 145 146 147 148 149 158 151 152 153 154 155 156 for (int tcol = @; tcol HTML > Java > PHP > Python } + o} > JAVA PROJECTS > MAVEN 48 A 004 157 158 159 * * Makes a collage of tiles from original Picture * original will have collageDimension x collageDimension tiles, each tile * has tileDimension x tileDimension pixels */ Public void motornilo Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 4 O CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 ArtCollage.java X Data Structures > ArtCollage.java > ts ArtCollage > colorizeTile(String, int, int) 154 155 * Makes a collage of tiles from original Picture 156 * original will have collageDimension x collageDimension tiles, each tile 157 + has tileDimension X tileDimension pixels 158 + / 159 public void makeCollage () { 160 161 for (int i = 0; i HTML > Java > PHP > Python + o} > JAVA PROJECTS > MAVEN 48 A 004 JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O ))) LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 177 178 * Colorizes the tile at (collageCol, collageRow) with component 179 * (see Week 9 slides, the code for color separation is at the * book's website) 188 181 El 182 183 * @param component is either red, blue or green * @param collageCol tile column * @param collageRow tile row + A 184 185 186 187 188 189 190 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 public void colorizeTile (String component, int collagecol, int collageRow) { for (int tcol = @; tcol HTML > Java > PHP > Python . 195 196 197 198 199 200 201 202 if (component.equals("red")) { newcolor = new Color(color:getRed0,0,0); } else if (component.equals("green")) { newColor = new Color(@,color.getGreen(),e); } else { newColor = new Color(@,,color.getBlue()); } collage.set((collageCol*tileDimension)+ tcol , (collageRow*tileDimension)+trow, newColor); o} > JAVA PROJECTS > MAVEN 48 A 004 203 204 205 206 Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 00 8:56 PM 2/11/2021 I Type here to search O 00) File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS x ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 182 * @param component is either red, blue or green 183 * @param collagecol tile column 184 * @param collageRow tile row 185 +/ 186 public void colorizeTile (String component, int collageCol, int collageRow) { 187 for (int tcol = 0; tcol HTML > Java > PHP > Python o} > JAVA PROJECTS > MAVEN 48 A 004 I Type here to search LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ts ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 218 211 212 + * Grayscale tile at (collageCol, collageRow) + (see Week 9 slides, the code for luminance is at the book's website) 213 214 * @param collageCol tile column * @param collageRow tile row A 215 216 217 218 219 220 221 222 223 224 225 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 public void grayscaletile (int collagecol, int collageRow) { for (int tcol = 0; tcol HTML > Java > PHP > Python 226 227 228 229 230 } 231 232 233 234 235 236 237 // testing client Run Debug public static void main (String[] args) { ArtCollage art = new ArtCollage (args[@]); art.showCollagePicture(); } } o} > JAVA PROJECTS > MAVEN 48 A 004 Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java 0 JavaSL-11 0 8:57 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help ArtCollage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u 223 V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) int scol = tempCol + original.width() / tileDimension; int srow = tempRow * original.height() / tileDimension; Color color = Luminance. toGray (original.get(scol, srow)); collage.set((collageCol*tileDimension)+ tcol , (collageRow tileDimension)+trow,color); 227 228 } } 224 225 DE 226 229 230 231 232 A 1 V OUTLINE v ArtCollage original collage collageDimension tileDimension // testing client Run Debug public static void main (String[] args) { ArtCollage art = new ArtCollage (args[@]); art.showCollagePicture(); } 233 234 235 236 237 1 } V SONARLINT RULES > HTML > Java > PHP > Python o} > JAVA PROJECTS > MAVEN 48 A 004 I Type here to search Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 CRLF Java o JavaSL-11 0 0 8:57 PM 2/11/2021 LE Test 6a: test colorizeTile("red", 0, 0) on a 4x4 tile collage failed. Comment Test 6b: test colorizeTile("blue", 1, 3) on a 4x4 tile collage failed. + Comment Test 6c: test colorizeTile("green", 3, 3) on a 4x4 tile collage failed. Comment Test 6d: test colorizeTile("red", 0, 1) on a 3x3 tile collage failed. + Comment Test 6e: test colorizeTile("blue", 1, 2) on a 3x3 tile collage failed. + Comment Test 6f: test colorizeTile("green", 2, 1) on a 3x3 tile collage failed. + Comment Test 7a: test grayscaleTile(2, 0) on a 3x3 tile collage failed. Comment Test 7b: test grayscaleTile(3, 3) on a 4x4 tile collage failed. Comment File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 8 V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 9 10 11 12 13 14 15 16 import javax.imareig: ImageIoi. import java.awt.*; import java.awt image. BufferedImage: import java.io.File; import java.io.IOException; public class ArtCollage { A // orginal picture private Picture original; 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 // collage picture private Picture collage; // collage Picture has collageDimension x collageDimension tiles private int collageDimension; V SONARLINT RULES > HTML > Java > PHP > Python 17 18 19 2e 21 22 23 12 23 24 25 26 27 28 29 30 31 32 33 34 35 // A tile has tileDimension X tileDimension pixels private int tileDimension; * One-argument Constructor * 1. set default values of collageDimension to 4 and tileDimension to 100 * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension collageDimension x tileDimension*collageDimens where each pixel is black (see all constructors for the Picture class). * 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) o} > JAVA PROJECTS > MAVEN 48 A 004 36 37 * @param filename the image filename Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 00 8:55 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > &s ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... PUTRA 28 29 30 31 32 33 34 35 36 37 38 39 40 41 + 42 * One-argument Constructor * 1. set default values of collageDimension to 4 and tileDimension to 180 * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension*collageDimension x tileDimension collageDimens where each pixel is black (see all constructors for the Picture class). 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) + A * @param filename the image filename 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 43 44 V SONARLINT RULES public ArtCollage (String filename) { collageDimension = 4; tileDimension = 100; original = new Picture(filename); collage = new Picture(tileDimension * collageDimension, tileDimension * collageDimension); for (int tcol = ; tcol HTML > Java > PHP > Python 45 46 . 47 48 49 50 } } 51 52 53 54 55 56 57 o} > JAVA PROJECTS > MAVEN 48 A 004 * Three-arguments Constructor * 1. set default values of collageDimension to cd and tileDimension to td + 2. initializes original with the filename image Ln 197, Col 54 (3 selected) Spaces: 4 VIF- CRLE Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O 0) 9 LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) } V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 2 52 53 54 55 56 57 ro 58 * Three-arguments Constructor * 1. set default values of collageDimension to cd and tileDimension to td * 2. initializes original with the filename image * 3. initializes collage as a Picture of tileDimension collageDimension x tileDimension collageDimens where each pixel is black (see all constructors for the Picture class). * 4. update collage to be a scaled version of original (see scaling filter on Week 9 slides) + A 59 68 61 62 63 64 * @param filename the image filename 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 65 66 V SONARLINT RULES 67 68 69 ze > HTML > Java > PHP > Python public Art Collage (String filename, int td, int cd) { this.collageDimension = cd; this.tileDimension = td; original = new Picture(filename); collage = new Picture(tileDimension * collageDimension, tileDimension * collageDimension); for (int tcol = ; tcol JAVA PROJECTS > MAVEN 48 A 004 * Returns the collageDimension instance variable Ln 197, Col 54 (3 selected) Spaces: 4 VIH-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help ArtCollage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > &s ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS x ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 78 79 80 * Returns the collageDimension instance variable + * @return collageDimension +/ 81 82 83 84 85 86 public int getCollageDimension() { return collageDimension; } A 87 88 89 /+ 1 * Returns the tileDimension instance variable V OUTLINE vs ArtCollage original collage collageDimension tileDimension + 1 * * @return tileDimension 90 91 91 92 93 94 public int gettileDimension() { return tileDimension; } V SONARLINT RULES 95 96 97 > HTML > Java > PHP > Python * Returns original instance variable 98 99 100 101 102 + * @return original */ public Picture getoriginalPicture() { return original; } 103 104 105 106 107 /* o} > JAVA PROJECTS > MAVEN 48 A 004 Returns collage instance variable Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... * Returns collage instance variable 106 107 108 109 110 + 111 112 113 + @return collage +/ public Picture getcollagePicture() { return collage; } A 114 115 116 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension + Display the original image * * Assumes that original has been initialized 1 117 118 119 120 public void showOriginalPicture() { original.show(); } V SONARLINT RULES 121 122 123 124 + > HTML > Java > PHP > Python 125 126 127 128 129 130 * Display the collage image * Assumes that collage has been initialized */ public void showcollagePicture() { collage.show(); } 131 132 133 134 135 /* * Replaces the tile at collageCol,collageRow with the image from filename + Tile (0,0) is the upper leftmost tile o} > JAVA PROJECTS > MAVEN 48 A 004 + @param filename image to replace tile Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O ))) LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) * V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... + * Replaces the tile at collageCol, collageRow with the image from filename * Tile (@,e) is the upper leftmost tile 138 131 132 133 120 134 135 136 137 138 139 140 * @param filename image to replace tile * @param collagecol tile column * @param collageRow tile row */ */ public void replaceTile (String filename, int collagecol, int collageRow) { Picture source2 = new Picture(filename); A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 V SONARLINT RULES 141 142 143 144 145 146 147 148 149 158 151 152 153 154 155 156 for (int tcol = @; tcol HTML > Java > PHP > Python } + o} > JAVA PROJECTS > MAVEN 48 A 004 157 158 159 * * Makes a collage of tiles from original Picture * original will have collageDimension x collageDimension tiles, each tile * has tileDimension x tileDimension pixels */ Public void motornilo Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 4 O CRLF Java JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 ArtCollage.java X Data Structures > ArtCollage.java > ts ArtCollage > colorizeTile(String, int, int) 154 155 * Makes a collage of tiles from original Picture 156 * original will have collageDimension x collageDimension tiles, each tile 157 + has tileDimension X tileDimension pixels 158 + / 159 public void makeCollage () { 160 161 for (int i = 0; i HTML > Java > PHP > Python + o} > JAVA PROJECTS > MAVEN 48 A 004 JavaSL-11 0 8:56 PM 2/11/2021 I Type here to search O ))) LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 177 178 * Colorizes the tile at (collageCol, collageRow) with component 179 * (see Week 9 slides, the code for color separation is at the * book's website) 188 181 El 182 183 * @param component is either red, blue or green * @param collageCol tile column * @param collageRow tile row + A 184 185 186 187 188 189 190 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 public void colorizeTile (String component, int collagecol, int collageRow) { for (int tcol = @; tcol HTML > Java > PHP > Python . 195 196 197 198 199 200 201 202 if (component.equals("red")) { newcolor = new Color(color:getRed0,0,0); } else if (component.equals("green")) { newColor = new Color(@,color.getGreen(),e); } else { newColor = new Color(@,,color.getBlue()); } collage.set((collageCol*tileDimension)+ tcol , (collageRow*tileDimension)+trow, newColor); o} > JAVA PROJECTS > MAVEN 48 A 004 203 204 205 206 Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java JavaSL-11 00 8:56 PM 2/11/2021 I Type here to search O 00) File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u V OPEN EDITORS x ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... A 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) 182 * @param component is either red, blue or green 183 * @param collagecol tile column 184 * @param collageRow tile row 185 +/ 186 public void colorizeTile (String component, int collageCol, int collageRow) { 187 for (int tcol = 0; tcol HTML > Java > PHP > Python o} > JAVA PROJECTS > MAVEN 48 A 004 I Type here to search LE File Edit Selection View Go Run Terminal Help Art Collage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u ArtCollage.java X Data Structures > ArtCollage.java > ts ArtCollage > colorizeTile(String, int, int) V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... 218 211 212 + * Grayscale tile at (collageCol, collageRow) + (see Week 9 slides, the code for luminance is at the book's website) 213 214 * @param collageCol tile column * @param collageRow tile row A 215 216 217 218 219 220 221 222 223 224 225 1 V OUTLINE vs ArtCollage original collage collageDimension tileDimension 1 public void grayscaletile (int collagecol, int collageRow) { for (int tcol = 0; tcol HTML > Java > PHP > Python 226 227 228 229 230 } 231 232 233 234 235 236 237 // testing client Run Debug public static void main (String[] args) { ArtCollage art = new ArtCollage (args[@]); art.showCollagePicture(); } } o} > JAVA PROJECTS > MAVEN 48 A 004 Ln 197, Col 54 (3 selected) Spaces: 4 UIF-8 CRLF Java 0 JavaSL-11 0 8:57 PM 2/11/2021 I Type here to search O LE File Edit Selection View Go Run Terminal Help ArtCollage.java - Untitled (Workspace) - Visual Studio Code X EXPLORER u 223 V OPEN EDITORS X ArtCollage.java 9+ UNTITLED (WORKSPACE) v Data Structures ArtCollage.java 9+ CS112 Recitation 1 - Greatest Hits o... ArtCollage.java X Data Structures > ArtCollage.java > ArtCollage > colorizeTile(String, int, int) int scol = tempCol + original.width() / tileDimension; int srow = tempRow * original.height() / tileDimension; Color color = Luminance. toGray (original.get(scol, srow)); collage.set((collageCol*tileDimension)+ tcol , (collageRow tileDimension)+trow,color); 227 228 } } 224 225 DE 226 229 230 231 232 A 1 V OUTLINE v ArtCollage original collage collageDimension tileDimension // testing client Run Debug public static void main (String[] args) { ArtCollage art = new ArtCollage (args[@]); art.showCollagePicture(); } 233 234 235 236 237 1 } V SONARLINT RULES > HTML > Java > PHP > Python o} > JAVA PROJECTS > MAVEN 48 A 004 I Type here to search Ln 197, Col 54 (3 selected) Spaces: 4 UIH-8 CRLF Java o JavaSL-11 0 0 8:57 PM 2/11/2021 LE

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Have to Do: Monitor the plan.

Answered: 1 week ago

Question

Have to Do: Embed the mission in the work.

Answered: 1 week ago