Java how to use a double or a string?
<p>Alright so I'm trying to get the user to input either the word "random" or a number (0.01) for a sales tax and my prompt can only use either keybd.next() or keybd.nextDouble() so how would I easily do this?</p>

<pre><code>public void calculateSalesReceipt(){
    System.out.println("Enter the sales tax percentage (ex. 0.08 for 8%) or type \"random\" for a random number: ");
    double tax = keybd.nextDouble();
    if(tax &lt; 0){
        System.out.println("You must enter a value equal to or greater than 0!");
    }else{
    getFinalPricePreTax();
    total = total;
    taxcost = total * tax;
    double finaltotal = total * taxcost;
    System.out.println("Sales Receipt");
    System.out.println("-------------");
    for(Item currentProduct : shoppingBag){
        System.out.println(currentProduct.getName() + " - " + currentProduct.getUnits() + " units " + " - $" + currentProduct.getCost());
    }
    System.out.println("Total cost: $" + total);
    System.out.println("Total tax: $" + taxcost);
    System.out.println("Total cost with tax: $" + finaltotal);
}
</code></pre>

<p>Thanks</p>
