Starting from:

$30

CS152- Assignment 1 Solved

This assignment consists of creating an abstract data type called ArtCollage, where you will create a collage of images.

Refer to our Programming Assignments FAQ for instructions on how to install VSCode, how to use the command line and how to submit your assignments.
Programming
We provide this ZIP FILE containing ArtCollage.java. Update and submit the file on Autolab.

Observe the following rules:

DO NOT use System.exit().
DO NOT add the project or package statements.
DO NOT change the class name.
DO NOT add import statements other than the Color class already in the ArtCollage.java file.
DO NOT change the headers of ANY of the given methods.
DO NOT add any new class fields.
ONLY display the result as specified by the example for each problem.
You may USE any of the libraries provided in the zip file.
ArtCollage (110 points). The ArtCollage class create a collage of image tiles and provides methods to transform the tiles individually. See ArtCollage.java for the description of each method.
One-argument Constructor
ArtCollage art = new ArtCollage(args[0]);
art.showCollagePicture();
 
 
The original image (args[0]) has 1536 rows x 1819 columns. The collage image that results from the one-argument constructor (on the left) has 400 rows by 400 columns.
 
Three-argument Constructor
ArtCollage art = new ArtCollage(args[0], 200, 3);
art.showCollagePicture();
 
 
The original image (args[0]) has 1536 rows x 1819 columns. The collage image that results from the three-argument constructor (on the left) has 600 rows by 600 columns.
 
MakeCollage method
// Creates a collage of 3x3 tiles. 
// Each tile dimension is 200x200 pixels.
ArtCollage art = new ArtCollage(args[0], 200, 3);
art.makeCollage();
art.showCollagePicture();
// Creates a default collage of 4x4 tiles. 
// Each default tile dimension is 100x100 pixels.
ArtCollage art = new ArtCollage(args[0]);
art.makeCollage();
art.showCollagePicture();
 
 
 
Change Tile Methods
// Creates a collage of 3x3 tiles. 
// Each tile dimension is 200x200 pixels
ArtCollage art = 
  new ArtCollage(args[0], 200, 3);

art.makeCollage();

// Colorize tile at col 2, row 2 
// to only show the red component
art.colorizeTile("red",2,2);
art.showCollagePicture();
// Creates a collage of 3x3 tiles. 
// Each tile dimension is 200x200 pixels
ArtCollage art = 
    new ArtCollage(args[0], 200, 3);

art.makeCollage();

// Colorize tile at col 2, row 1 
// to only show the blue component
art.colorizeTile("blue",2,1);
art.showCollagePicture();
// Creates a collage of 3x3 tiles. 
// Each tile dimension is 200x200 pixels
ArtCollage art = 
     new ArtCollage(args[0], 200, 3);

art.makeCollage();

// Colorize tile at col 0, row 0 
// to only show the green component
art.colorizeTile("green",0,0);
art.showCollagePicture();
 
 
 
// Creates a collage of 3x3 tiles. Each tile dimension is 200x200 pixels
ArtCollage art = 
    new ArtCollage(args[0], 200, 3);

art.makeCollage();

// Converts the tile at col 1, row 0 
// from color to greyscale
art.grayscaleTile(1, 0);
art.showCollagePicture();
// Creates a collage of 3x3 tiles. 
// Each tile dimension is 200x200 pixels
ArtCollage art = 
  new ArtCollage(args[0], 200, 3);

art.makeCollage();

// Replace tile at col 1, row 1 with 
// args[1] image
art.replaceTile(args[1],1,1);
art.showCollagePicture();
 
 
 
 
Note: Make sure to test colorizeTile() and greyscaleTile() using a collage where each tile has a different image.
 
ArtCollage art = new ArtCollage(args[0], 200, 2);
art.makeCollage();

// Replace 3 tiles 
art.replaceTile(args[1],0,1);
art.replaceTile(args[2],1,0);
art.replaceTile(args[3],1,1);
art.colorizeTile("green",0,0);
art.showCollagePicture();.

More products