/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.exampractice;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class AscendingOrderOf3 {
    public static void main(String[] args)
    {
        // Create scanner
        Scanner input = new Scanner(System.in);
        
        //Define variables
        int x, y, z;
        int firstNumber=-1, secondNumber=-1, thirdNumber=-1;
        // Prompt for input
        System.out.print("Enter a 3 integers: ");
        x = input.nextInt();
        y = input.nextInt();
        z = input.nextInt();
        
        // Compute!
        if (x <= y && x <= z) {// Check if x is greater than y && y is greater than z
            System.out.println("1st if condition met");
            firstNumber = x;
            if (y <= z) {
                secondNumber = y;
                thirdNumber = z;
            }
            else {
                secondNumber = z;
                thirdNumber = y;
            }
        }
        if (y <= x && y <= z) {
            System.out.println("2nd if condition met");
            firstNumber = y;
            if (x <= z) {
                secondNumber = x;
                thirdNumber = z;
            }
            else {
                secondNumber = z;
                thirdNumber = x;
            }
        }
        if (z <= y && z <= x) {
            System.out.println("3rd if condition met");
            firstNumber = z;
            if (z <= x) {
                secondNumber = y;
                thirdNumber = x;
            }
            else {
                secondNumber = x;
                thirdNumber = y;
            }
        }
        // Output
        System.out.println(firstNumber + ", " + secondNumber + ", " + thirdNumber);
    }
}
