# 3.25 Java3024r review

 Page 1 / 1
This module contains review questions and answers keyed to the module titled Java3024: Mirroring Images.

Revised: Mon Apr 04 09:53:24 CDT 2016

## Preface

This module contains review questions and answers keyed to the module titled Java3024: Mirroring Images .

The questions and the answers are connected by hyperlinks to make it easy for you to navigate from the question to the answer and back again.

## Question 1.

Given the input image shown in Figure 1 , which of the following output images is produced by the code in Listing 1 ?

A. Figure 2

B. Figure 3

Listing 1 . Question 1.
```/*File Java3024ra Copyright 2013 R.G.Baldwin *********************************************************/import java.awt.Graphics2D; import java.awt.geom.AffineTransform;import java.awt.geom.Rectangle2D; import java.awt.Graphics;public class Java3024ra{ public static void main(String[]args){ new Java3024raRunner().run();}//end main method }//end class Java3024ra//======================================================// class Java3024raRunner{public void run(){ Picture pix = new Picture("Prob02a.jpg");pix = rotatePicture(pix,35); pix = mirrorUpperQuads(pix);pix = mirrorHoriz(pix); pix.explore();System.out.println(pix); }//end run//----------------------------------------------------// private Picture rotatePicture(Picture pix,double angle){ AffineTransform rotateTransform =new AffineTransform(); rotateTransform.rotate(Math.toRadians(angle),pix.getWidth()/2, pix.getHeight()/2);Rectangle2D rectangle2D = pix.getTransformEnclosingRect(rotateTransform);int resultWidth = (int)(rectangle2D.getWidth()); int resultHeight = (int)(rectangle2D.getHeight());AffineTransform translateTransform = new AffineTransform();translateTransform.translate( (resultWidth - pix.getWidth())/2,(resultHeight - pix.getHeight())/2); translateTransform.concatenate(rotateTransform);Picture result = new Picture( resultWidth,resultHeight);Graphics2D g2 = (Graphics2D)result.getGraphics(); g2.drawImage(pix.getImage(),translateTransform,null);return result; }//end rotatePicture//----------------------------------------------------// private Picture mirrorUpperQuads(Picture pix){Pixel leftPixel = null; Pixel rightPixel = null;int midpoint = pix.getWidth()/2; int width = pix.getWidth();for(int row = 0;row<pix.getHeight()/2;row++){ for(int col = 0;col<midpoint;col++){ leftPixel = pix.getPixel(col,row);rightPixel = pix.getPixel(width-1-col,row); rightPixel.setColor(leftPixel.getColor());}//end inner loop }//end outer loopreturn pix; }//end mirrorUpperQuads//----------------------------------------------------// private Picture mirrorHoriz(Picture pix){Pixel topPixel = null; Pixel bottomPixel = null;int midpoint = pix.getHeight()/2;int height = pix.getHeight(); for(int col = 0;col<pix.getWidth();col++){ for(int row = 0;row<midpoint;row++){ topPixel = pix.getPixel(col,row);bottomPixel = pix.getPixel(col,height-1-row); bottomPixel.setColor(topPixel.getColor());}//end inner loop }//end outer loopreturn pix; }//end mirrorHoriz//----------------------------------------------------// }//end class Java3024raRunner```

Figure 1 - Prob02a.jpg.

Figure 2 - Possible output image.

Figure 3 - Possible output image.

## Listings

What is the meaning of the following two images?

This image was inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.

The image is also an example of the kinds of things that we do in my course titled ITSE 2321, Object-Oriented Programming.

This image was also inserted for the purpose of inserting space between the questions and the answers.

The code in Listing 1 produces the output image shown in Figure 2 .

## Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
• Module name: Java3024r Review
• File: Java3024r.htm
• Published: 02/18/13
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download aPDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version ofthe module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale onAmazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If youpurchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made andpublished without my prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

-end-

what is economics
what do you mean by means in economics
Julie
economic is the wealth of a country.
Moussa
monetary policy is refer to as being expansionary or contractionary.
Abdul
important of unemployment
Important of unemployed
Otwe
important?
Aneela
what is meaning scarcity
what is consumer
how do consumer help people
Brenda
Jayah
How do you mean Jayah
Danjuma
what is different between price and quantity
Yakubu
what is MRS
Rashid
definition of economics according to Adam Smith
economic is a wealth of nation
Au
in the view of Adam Smith economics is the study of activities of people in production of wealth
suresh
What do you really think is the remedy for scarcity in Nigeria 🇳🇬
different the term economics
importance of studying economics
importance of economics
Haruna
different the term economics
zfekere
mixed economic
you have just been appointed in the director of finance for your state internal revenue board with the knowledge of elasticity advice the state government on how the I.G.R of the state could be raised through exercise duties bearing in mind the implication and incident of taxing setting products
Esmael
fine
IDRIS
mention 5 characteristics of traditional societies
dominance of agriculture and ignorance of development avenues are some characteristics of traditional societies.
what's defined as unemployment
what is elasticity
Elasticity is defined as the degree of responsiveness of quantity demanded to slight change in price, cost of other products and income of consumer.....
Danjuma
elasticity simply means change. it is the degree of responsiveness of quantity demanded of a commodity to changes in the price of a commodity
Emmanuel
what is monetary policy
Rashid
Monetary Policy; is the objectives of the central bank in exercising its control over money, interest rates, and credit conditions.
Hamed
So does it mean that ceteris paribus is the same as all other things being equal?
Yes nothing else has been changed
Abi
ways by which trade unoins raise wage of it's members
what is economic growth
increase a amount of goods and services produced as per head of population a period of time
SHOM
Economic growth and development has been defined in so many ways by various economist. At a time past, people started raising questions about having economic growth as the same in meaning development. They do not mean the same thing but they are however interdependent and inter related.
Nder
For economic development is not possible without economic growth but economic growth is possible without economic development. For example, when there is an observed increase in GDP from 3 million to 4 million over a period of 5 years, we say that there is economic growth.
Nder
Got questions? Join the online conversation and get instant answers!