ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 29 May 2017 My Price 8.00

Write a method changeBlue(weight)

Question 1.

Write a method changeBlue(weight). Do not change any color of the pixels in the first half of a picture. For the second half, change blue value of each pixel by new blue * weight. For example, if a pixel has values (200,100,100) and weight is 0.5, then the new values will be (200,100,50). If the weight is 1.5, then the new values will be (200,100,150).

 

This is first half, do not change!

 

This is second half, change blue.

 

 

 

 

 

 

Question 2.

Write a method mirrorVertical(). The method  mirrors the left half of a picture to  the right half of the picture. For instance, the two pictures below show that the left one is the original picture, and the right one is the new picture.

 

 

 

Question 3.

Write a method copyPart(w,h). The method copies an upper left rectangle area in an image to its lower right area. w and h are width and height of the rectangle. In the figure below, |ab| is w and |ac| is h. We assume that 2*w is less than the picture’s width,  and 2*h is less than the picture’s height. That is, the source area and the destination area are not overlapped and w or h is not out of bound.

 

 

All methods need to be included in the file Picture.java. Once you are finished, recompile your Picture.java, and then test your methods in DrJava. You can use any picture to test your programs.

 

CSCI 1302 Lab 3Cutoff:09/24/2015(100 points)Question 1.Write a method changeBlue(weight). Do not change any color of the pixels in the first half of apicture. For the second half, change blue value of each pixel by new blue=original blue * weight.For example, if a pixel has values (200,100,100) and weight is 0.5, then the new values will be(200,100,50). If the weight is 1.5, then the new values will be (200,100,150).Question 2.Write a method mirrorVertical(). The methodmirrors the left half of a picture tothe right half ofthe picture. For instance, the two pictures below show that the left one is the original picture, andthe right one is the new picture.Question 3.Write a method copyPart(w,h). The method copies an upper left rectangle area in an image to itslower right area. w and h are width and height of the rectangle. In the figure below, |ab| is w and |ac| is h. We assume that 2*w is less than the picture’s width,and 2*h is less than the picture’sThis is frst halF, do not change!This is second halF, change blue.

import javax.imageio.ImageIO;import java.awt.image.BufferedImage;import javax.swing.ImageIcon;import java.awt.*;import java.io.*;import java.awt.geom.*;/*** A class that represents a simple picture.A simple picture may have* an associated file name and a title.A simple picture has pixels,* width, and height.A simple picture uses a BufferedImage to* hold the pixels.You can show a simple picture in a* PictureFrame (a JFrame).** Copyright Georgia Institute of Technology 2004* @author Barb Ericson ericson@cc.gatech.edu*/public class SimplePicture implements DigitalPicture{/////////////////////// Fields //////////////////////////*** the file name associated with the simple picture*/private String fileName;/*** the title of the simple picture*/private String title;/*** buffered image to hold pixels for the simple picture*/private BufferedImage bufferedImage;/*** frame used to display the simple picture*/private PictureFrame pictureFrame;/*** extension for this file (jpg or bmp)*/private String extension;/////////////////////// Constructors //////////////////////////*** A Constructor that takes no arguments.All fields will be null.* A no-argument constructor must be given in order for a class to* be able to be subclassed.By default all subclasses will implicitly* call this in their parent's no argument constructor unless a* different call to super() is explicitly made as the first line* of code in a constructor.*/public SimplePicture(){this(200,100);}/*** A Constructor that takes a file name and uses the file to create* a picture

Attachments:

Answers

(11)
Status NEW Posted 29 May 2017 08:05 AM My Price 8.00

-----------

Attachments

file 1496046211-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)