Announcement

Collapse
No announcement yet.

Three Number + Sort

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Three Number + Sort

    class three numbers
    PHP Code:
    package numbers;

    import java.io.PrintStream;
    import java.util.Arrays;
    import java.util.Scanner;

    /**
    * Created with xgiovio.macbookair.
    * User: xgiovio
    * Date: 14/10/13
    * Time: 13:29
    */
    public class three_numbers {

    public 
    three_numbers (Scanner x_in){
    array[
    0]=x_in.nextDouble();
    array[
    1]=x_in.nextDouble();
    array[
    2]=x_in.nextDouble();
    }

    public 
    void sort(){
    Arrays.sort(array);
    }

    public 
    void print(PrintStream out){
    out.println(array[0]);
    out.println(array[1]);
    out.println(array[2]);

    }

    private 
    double [] array = new double[3];


    main
    PHP Code:
    import numbers.three_numbers;

    import java.io.File;
    import java.io.PrintStream;
    import java.util.Scanner;

    /**
     * Created with xgiovio.macbookair.
     * User: xgiovio
     * Date: 23/09/13
     * Time: 14:57
     */


    public class test {

        public static 
    void main (String [] input_datathrows Exception {


        
    three_numbers array = new three_numbers(new Scanner(new File ("giorgio.dat")));
        array.
    sort();
        array.print(
    System.out);

        }

    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia