Page 1 of 1

Advanced Java Help! Please dont copy answers This is for the intermediate class All files provided are below ///////////

Posted: Tue Jul 12, 2022 8:11 am
by answerhappygod
Advanced Java Help! Please dont copy answers
This is for the intermediate class
All files provided are below
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
According to a recent statistic, a typical programmer spends approximately 70-percent of his or her time maintaining, updating, correcting, etc., existing code that may have been poorly written in the first place. That same programmer may spend ten-percent of his or her time writing new code for new projects. The remaining twenty-percent of the programmer's time is spent on other activities.
Among other things, the purpose of this assignment is to access the student's ability to analyze the code in a functional program and then modify that code to change the behavior of the program according to a given set of specifications.
You will find the following files (plus some others) in the same zip file from which you extracted this project specification.
Proj09.htm (this file)Framework01.javaFramework01Intfc.javaImageProcessor01.javaFramework01Test01.batTestImage.jpg
The commands in the bat file shows how to compile and execute the program for the given image file.
javac -version
javac Framework01.java
javac ImageProcessor01.java
java Framework01
pause
Your first step should be to compile and execute the program and to observe the output images produced by the program. Note in particular that you can see some thin strips of yellow background on the large image.
Next you should analyze the code in the three Java source code files and confirm that you understand how that code produces the output that you see for both images.
Your next step should be to copy the three Java source code files into three new files named
Framework02.javaFramework02Intfc.javaImageProcessor02.java
Also copy the file named Framework01Test01.bat into a new file named Framework02Test01.bat.
Your challenge is to modify the code in the new source code files such that they produce the output images shown below. Also update the commands in the new .bat file so that it works properly with the new source code files.
More specifically, you must make the following changes:
Replace the white straight line with a white circle in the center of the image having a radius specified by the GUI. Draw the circle in such a way as to avoid sparse pixels in one or the other dimension. Make the initial radius 20 pixels.
Enter your name in the header for both frames.
Change the background color from yellow to cyan.
Move the Replot button to the top.
Add the following certification to the command-line output. Be sure to include your name in all three locations.
Encapsulate the following files, plus any other files that you may have created in a zip file and submit the zip file via Blackboard.
Proj09.htm (this file)Framework02.javaFramework02Intfc.javaImageProcessor02.javaFramework02Test01.batTestImage.jpg
It must be possible for me to compile, run, and test your program simply by executing the file named Framework02Test01.bat.
Advanced Java Help Please Dont Copy Answers This Is For The Intermediate Class All Files Provided Are Below 1
Advanced Java Help Please Dont Copy Answers This Is For The Intermediate Class All Files Provided Are Below 1 (55.48 KiB) Viewed 28 times
Advanced Java Help Please Dont Copy Answers This Is For The Intermediate Class All Files Provided Are Below 2
Advanced Java Help Please Dont Copy Answers This Is For The Intermediate Class All Files Provided Are Below 2 (7.21 KiB) Viewed 28 times
Given files below:
Framework01Intfc.java:
interface Framework01Intfc{int[][][] processImg(int[][][] threeDPix,int imgRows,int imgCols);}//end Framework01Intfc
ImageProcessor01.java:
import java.awt.*;import java.awt.event.*;import java.awt.image.*;import java.io.*;
class ImageProcessor01 extends Frameimplements Framework01Intfc{
double slope;//Controls the slope of the lineString inputData;//Obtained via the TextFieldTextField inputField;//Reference to TextField
//Constructor must take no parametersImageProcessor01(){//Create and display the user-input GUI.setLayout(new FlowLayout());
Label instructions = new Label("Type a slope value and Replot.");add(instructions);
inputField = new TextField("1.0",5);add(inputField);
setTitle("Copyright 2004, Baldwin");setBounds(400,0,200,100);setVisible(true);}//end constructor
//The following method must be defined to// implement the Framework01Intfc interface.public int[][][] processImg(int[][][] threeDPix,int imgRows,int imgCols){
//Display some interesting informationSystem.out.println("Program test");System.out.println("Width = " + imgCols);System.out.println("Height = " + imgRows);
//Make a working copy of the 3D array to// avoid making permanent changes to the// image data.int[][][] temp3D =new int[imgRows][imgCols][4];for(int row = 0;row < imgRows;row++){for(int col = 0;col < imgCols;col++){temp3D[row][col][0] =threeDPix[row][col][0];temp3D[row][col][1] =threeDPix[row][col][1];temp3D[row][col][2] =threeDPix[row][col][2];temp3D[row][col][3] =threeDPix[row][col][3];}//end inner loop}//end outer loop
//Get slope value from the TextFieldslope = Double.parseDouble(inputField.getText());
//Draw a white diagonal line on the imagefor(int col = 0;col < imgCols;col++){int row = (int)(slope*col);if(row > imgRows -1)break;//Set values for alpha, red, green, and// blue colors.temp3D[row][col][0] = (byte)0xff;temp3D[row][col][1] = (byte)0xff;temp3D[row][col][2] = (byte)0xff;temp3D[row][col][3] = (byte)0xff;}//end for loop//Return the modified array of image data.return temp3D;}//end processImg}
framework01.java:
codeshare.io/wnxM0x
Print your name here Replot X F
Put your name here. Type a radius value and Replot. 20 X