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());
}
}