I'm trying to write an application that inputs a dollar amount to be printed on a check, I'm having trouble figuring out how to print out the number in a check protected with leading **** asterisks.
Here's the code I have so far
import java.text.DecimalFormat;
import java.util.Scanner;
import java.text.NumberFormat;
import java.util.Locale;
public class CheckProtection
{
private static double maxAmount = 1000;
public static void main (String args [])
{
//System.out.printf(checkFormatter.format(check));
//DecimalFormat checker = new DecimalFormat("******.**");
//System.out.println(checker);
boolean validEntry = false;
while (validEntry == false)
{
Scanner userEntry = new Scanner(System.in);
System.out.println("Enter The check amount under a $1000.00 and greater that 0.");
if (userEntry.hasNextDouble() == true)
{
double check = userEntry.nextDouble();
if (check > 0)
{
if(check < maxAmount)
{
validEntry = true;
NumberFormat checkFormatter = NumberFormat.getCurrencyInstance();
checkFormatter.format(check);
System.out.printf("%5s",+ check);
}
}
}
}
}