Question: Part E: Picture Roulette 10) Creat a new java program called PictureRoulette.java that takes at least one runtime parameter and also a second possible runtime

Part E: Picture Roulette

10) Creat a new java program called PictureRoulette.java that takes at least one runtime

parameter and also a second possible runtime parameter. The first runtime parameter is the

fully qualified filename of an image file. The second (optional) parameter is an integer

between 0 and 9.

11) If there isn't a first parameter the program should print an error message and quit. You don't

know how to check to see if this parameter represents a valid filename so just quit the

program if there aren't any parameters entered.

12) Assuming an image filename is passed in correctly as the first parameter, the program should

then check to see if a number betwee not an integer between 0 and 9, the program should

again print out an error message and quit. The following line of code will be useful to you for

converting a command line parameter to an integer:

num = Integer.parseInt(args[1]);

13) If there was no number passed in as a second parameter, your program should generate a

random number between 0 and 9 then output that information to the console, something like

this:

Number generated is 7.

14) Assuming that the filename is passed in and the number is passed in (or generated) correctly,

the program should use the number as a switch value and run an image modification method

on the photo, according to the number passed in. You should also output information to the

console about what is being done to the image. For example, if you entered a 7, you should

print out something like this (see the table below):

Running reverse method on image.

15) The table below shows what image methods from Picture.java should be called based on the

number passed in or generated. (For number 1, assume "pic" is the name of your Picture

object.) If you don't have one of those methods shown below you may substitute a different

one but you need ten unique methods.

Number Picture.java method and parameters

0 blurArea(...) // blur the whole picture with level 6

1 crop(pic.getWidth()/3, pic.getHeight()/3,

pic.getWidth()/3, pic.getHeight()/3)

2 horizontalShutters()

3 checkerboard(10, Color.BLACK)

4 verticalShutters()

5 mirrorHorizontalBottomToTop()

6 fade() (5 times)

7 reverse()

8 decreaseBlue(0.2)

9 colorfulEdgeDetection(7.0, 50)

16) After running the appropriate method on the image, the image should be shown on screen.

17) When you are satisfied that your PictureRoulette.java program you are done with the

required parts for this lab. For this part you will need to submit the PictureRoulette.java file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!