Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

java homework

yw558
yw558 


finish the assignment on time using java eclipse. Attachments Tags Clarifications

Answers

JAVA source files

Seeker
Seeker 



Source code and screen shot of output attached Attachments
yw558.zip (106 K) Download
Preview
System.out.println("width and height = " + r2.getWidth() + " x " + r2.getHeight()); System.out.println("coordinates = " + r2.getxPosition() + ", " + r2.getyPosition()); System.out.println("area: " + r2.getArea()); System.out.println("perimeter: " +

Preview
Try again\r\nEnter longitude:"); } } success = false; while(!success){ String sLat = scanner.nextLine(); try{ // parse string into double lat = Double.parseDouble(sLat); success = true; }catch(Exception e){ System.out.println("Please enter a valid latitude. Try again\r\nEnter latitude"); }

Preview
number to both arrays int nextInt = r.nextInt(1000); numsToSort1[i] = nextInt; numsToSort2[i] = nextInt; } ct.stop(); System.out.println("Took: " + ct.getElapsedTime() + " seconds to create the arrays"); ct.start(); int min; // iterate double for loop for sort

Preview
class Assignment08 { public static void main(String[] args){ int[][] testMatrix = { {5,2,4}, {3,1,7}, {9,3,2} }; IntegerMatrix tester = new IntegerMatrix(testMatrix); tester.printMatrix(); testMatrix[0][0] = 999; tester.printMatrix(); System.out.println("Sum of all elements: " + tester.getSumOfAllElements()); System.out.println("Sum

Preview
public void setName(String name) { this.name = name; } public double getLon() { return lon; } public void setLon(double lon) { this.lon = lon; } public double getLat() { return lat; }

Preview
= System.currentTimeMillis(); } public void start(){ this.startTime = System.currentTimeMillis(); this.endTime = -1; } public void stop(){ this.endTime = System.currentTimeMillis(); }

Preview
public Location findSmallest(){ int row = 0, col = 0, value = matrix[0][0]; for(int i = 0; i < matrix.length; i++){ for(int j = 0; j < matrix[i].length; j++){ if(matrix[i][j] < value){ value = matrix[i][j]; row = i; col = j;

Preview
public Location(int row, int col, int value){ this.row = row;

Preview
getPerimiter(){ return 2 * this.width + 2 * this.height; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getHeight() { return height; } public

Preview

output.jpg (73 K) Download Preview

Screenshots
Screenshot
Screenshot
Purchase Answer

full Answer

uetian_cute
uetian_cute 



The complete answer. Attachments
asignment07.zip (153 K) Download






Preview
public class Assignment08 { /** * @param args */ public static void main(String[] args) { // define our test matrix int[][] testMatrix = { { 5, 2, 4 }, { 3, 1, 7 }, { 9, 3, 2 }

Preview
print array in rectangular form for (int i=0; i<srcarray.length; i++) { for (int j=0; j<srcarray[i].length; j++) { System.out.print(" " + srcarray[i][j]); } System.out.println(""); } } /*sun of a matrix*/ public int getSumOfAllElements() { int sum=0; for (int i=0; i<srcarray.length; i++) {

Preview
v) {row=r; col=c; value=v; }

Preview
args) { // TODO Auto-generated method stub /*Rectangle 1*/ Rectangle objectRect1=new Rectangle(10, 10, -5, 5); System.out.println("Rectangle #1"); System.out.println("Width & Height = "+objectRect1.width+" x "+objectRect1.height); System.out.println("Width

Preview
double area=width*height; /*area of rectangle is width X height*/ return area; } public double getPerimeter() {

Preview
= new Scanner( System.in ); Scanner inpdbl = new Scanner( System.in ); System.out.println("City #"+(i+1)); System.out.println("Enter name: "); name=inpname.next(); System.out.println("Enter longitude: "); lon=inpdbl.nextDouble(); System.out.println("Enter latitude: "); lat=inpdbl.nextDouble(); cities[i]=new City(name, lon, lat); } for(int i=0;i<numbofcity;i++) { cities[i].report();

Preview
{ /*Variable declaration*/ String name; double lon,lat; /*constructor that accept the double values*/ City(String n, double ln,double lt) {

Preview
public static void selectionSort(int[] arrayToSort) { // begin by entering into a for loop to examine all elements for (int i = 0; i < arrayToSort.length; i++) { // we want to ensure that this is the lowest possible value of all elements that come

Preview
start() { starttime=System.currentTimeMillis(); } public void end() { endtime=System.currentTimeMillis(); } public long getElapsedTime() { return elapsedtime=endtime-starttime;

Screenshots
Purchase Answer