I need it to read all three of the numbers and up them back least to greatest. As of right now all it prints is 0.0 for all 3 and true. How do I get it to not print true and 0.0 and print the acual numbers.

``````public class Floating
{
private double x;
private double y;
private double z;

public Floating(double x2, double y2,double z2)
{
x2 = x;
y2 = y;
z2 = z;
}

public boolean getorder()
{
if(x <= y && y <= z)
{
System.out.println(x);
System.out.println(y);
System.out.println(z);
}

else if (x <= z && z <= y)
{
System.out.println(x);
System.out.println(z);
System.out.println(y);
}

else if(z <= x && x <= y)
{
System.out.println(z);
System.out.println(x);
System.out.println(y);
}

else if(z <= y && y <= x)
{
System.out.println(z);
System.out.println(y);
System.out.println(x);
}

else if(y <= z && z <= x)
{
System.out.println(y);
System.out.println(z);
System.out.println(x);
}

else if(y <= x && x <= z)
{
System.out.println(y);
System.out.println(x);
System.out.println(z);
}
else
System.out.println("SYSTEM ERROR PLEASE RETRY");
return true;
}

}``````
``````import java.util.Scanner;

public class FloatingTester
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter Your First Number");
double x = keyboard.nextDouble();

System.out.println("Enter Your Second Number");
double y = keyboard.nextDouble();

System.out.println("Enter Your Third Number");
double z = keyboard.nextDouble();

Floating set1 = new Floating(x,y,z);

System.out.println(set1.getorder());

}
}``````
3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by theonly

line 10 reverse annotation - error
same line 11,12

I changed those but still prints same.

``````public class Floating
{
private double x;
private double y;
private double z;

public Floating(double x, double y,double z)
{

}

public boolean getorder()
{
if(x <= y && y <= z)
{
System.out.println(x);
System.out.println(y);
System.out.println(z);
}

else if (x <= z && z <= y)
{
System.out.println(x);
System.out.println(z);
System.out.println(y);
}

else if(z <= x && x <= y)
{
System.out.println(z);
System.out.println(x);
System.out.println(y);
}

else if(z <= y && y <= x)
{
System.out.println(z);
System.out.println(y);
System.out.println(x);
}

else if(y <= z && z <= x)
{
System.out.println(y);
System.out.println(z);
System.out.println(x);
}

else if(y <= x && x <= z)
{
System.out.println(y);
System.out.println(x);
System.out.println(z);
}
else
System.out.println("SYSTEM ERROR PLEASE RETRY");
return true;
}

}``````

Edited by muncher10: n/a

``````public Floating(double x2, double y2,double z2)
{
x = x2;
y = y2;
z = z2;
}``````

Thanks finally figure that out but how do I get true to stop being printed?

remove "return true"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.