/home/caleb/ASDV-Java/lab8_CalebFontenot/src/main/java/com/calebfontenot/lab8_calebfontenot/DecimalToHex1.java
/*
 * 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.lab8_calebfontenot;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class DecimalToHex1 {
    public static void main(String[] args) {
        // Define vars
        int inputDecimal,
            outputHex = 0x0;
        
        // Create scanner
        Scanner input = new Scanner(System.in);
        
        // Prompt for input
        System.out.print("Enter a decimal value (0-15): ");
        inputDecimal = input.nextInt();
        
        // Switch moment
        switch (inputDecimal) {
            case 0:
                outputHex = 0x0; break;
            case 1:
                outputHex = 0x1; break;
            case 2:
                outputHex = 0x2; break;
            case 3:
                outputHex = 0x3; break;
            case 4:
                outputHex = 0x4; break;
            case 5:
                outputHex = 0x5; break;
            case 6:
                outputHex = 0x6; break;
            case 7:
                outputHex = 0x7; break;
            case 8:
                outputHex = 0x8; break;
            case 9:
                outputHex = 0x9; break;
            case 10:
                outputHex = 0xA; break;
            case 11:
                outputHex = 0xB; break;
            case 12:
                outputHex = 0xC; break;
            case 13:
                outputHex = 0xD; break;
            case 14:
                outputHex = 0xE; break;
            case 15:
                outputHex = 0xF; break;
                
        }
        
        // Output
        System.out.println("The hex value is " + String.format("%x", outputHex));
    }
}