-4

Can someone please help me how to solve it?

Create a new class named blabla in the bla package. An instance of the class should be able to store a two-dimensional array of type double. The size of the array is not bound. The class should have a no-parameter procedure-like method named sortRows. The method should sort rows of the array in the following manner: the values of the last column must be in a descending order (greatest first, smallest last).

So i tried to do myself, please help me if there is a mistake.

  double temp = 0;

    double[][] number;

    boolean fixed=false;
    while(fixed==false){
        fixed=true;
    }
    number = new double[5][5];
    for(int i=0; i<number.length-1; i++){
        if(number[i][i] > number[i+1][i+1])

        temp = number[i+1][i+1];
        number[i+1][i+1] = number[i][i];
        number[i][i]=temp;
        fixed=false;
    }
            for(int i=0; i<number.length; i++){

    System.out.println(number[i][i]);
}
  • 1
    We'll be glad to help, but you need to ask a question letting us know where your stuck. Simply posting your assignment is not enough, and we're certainly not going to do your homework for you. So please put a little effort into improving your question, and you'll likely get good help. – Hovercraft Full Of Eels Apr 28 '13 at 21:23
  • 1
    How much will you pay me to do your homework? :D – DerpyNerd Apr 28 '13 at 21:24
  • His question is: "Will someone do my homework for me?" The parameters of his assignment are clearly laid out for him, but he either doesn't understand or doesn't want to do his work. – MarsAtomic Apr 28 '13 at 21:27
  • actually i havent learned how to do it yet and have no idea.. already tried to solve myself but couldnt :/ – user2330096 Apr 28 '13 at 21:30

1 Answers1

2

Well, I'm not gonna do your homework!

You should be able to create a class in a package yourself, For creating dynamic arrays, check this topic: Variable length (Dynamic) Arrays in Java

For sorting arrays, check this topic: char multidimensional array sorting in java

This should get you going, I hope ;)

Community
  • 1
  • 1
DerpyNerd
  • 4,743
  • 7
  • 41
  • 92