i have a computer science 201 assignment to be done by tonight homework + extra credit
import java.awt.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.image.BufferedImage; import java.text.*; import java.util.*; import java.util.List; // resolves problem with java.awt.List and java.util.List /** * A class that represents a picture. This class inherits from * SimplePicture and allows the student to add functionality to * the Picture class. * * Copyright Georgia Institute of Technology 2004-2005 * @author Barbara Ericson [email protected] */ public class Picture extends SimplePicture { ///////////////////// constructors ////////////////////////////////// /** * Constructor that takes no arguments */ public Picture () { /* not needed but use it to show students the implicit call to super() * child constructors always call a parent constructor */ super(); } /** * Constructor that takes a file name and creates the picture * @param fileName the name of the file to create the picture from */ public Picture(String fileName) { // let the parent class handle this fileName super(fileName); } /** * Constructor that takes the width and height * @param width the width of the desired picture * @param height the height of the desired picture */ public Picture(int width, int height) { // let the parent class handle this width and height super(width,height); } /** * Constructor that takes a picture and creates a * copy of that picture */ public Picture(Picture copyPicture) { // let the parent class do the copy super(copyPicture); } /** * Constructor that takes a buffered image * @param image the buffered image to use */ public Picture(BufferedImage image) { super(image); } ////////////////////// methods /////////////////////////////////////// /** * Method to return a string with information about this picture. * @return a string with information about the picture such as fileName, * height and width. */ public String toString() { String output = "Picture, filename " + getFileName() + " height " + getHeight() + " width " + getWidth(); return output; } /** * * clears all red values from the picture **/ public void clearRed() { Pixel[] pixelArray = this.getPixels (); Pixel onePixel ; int i; i = 0; while (i < this.getHeight() *this.getWidth()) { onePixel = pixelArray[i]; onePixel.setRed(0); i = i + 1; } } /** clears all the green * */ public void clearGreen(){ Pixel[] pixelArray = this.getPixels (); Pixel onePixel ; int i; i = 0; while (i <this.getHeight() * this.getWidth()) { onePixel = pixelArray[i]; onePixel.setGreen(0); i = i + 1; } } /** clears all the blue **/ public void clearBlue() { Pixel [] pixelArray = this.getPixels (); Pixel onePixel; int i; i = 0; while (i < this.getHeight () * this.getWidth()) { onePixel = pixelArray [i]; onePixel.setBlue(0); i = i + 1; } } public void lighten() { Pixel [] pixelArray = this.getPixels(); Pixel onePixel ; int i; i = 0; while ( i < this.getHeight () * this.getWidth()) { onePixel = pixelArray [i]; onePixel.getColor(); i = i + 1; } } }// this } is the end of class Picture, put all new methods before this