I currently have a code that works properly (compiled and tested multiple times) however I am outputting:
Card Balance: $500.0
Minimum payment to principle (3% of principle): $15.0
Minimum total payment (payment and fees): $60.0
and I need these values to print out with 2 decimals instead of 1 (500.00 instead of 500.0). I know this is petty and simple, but no other forum has helped me thus far - when I try printf I get a conversion error, when I try DecimalFormat I get an error that DecimalFormat does not exist. I'm just at a loss and would appreciate any help. I will include all relevant code below (but for relevance issues I won't add all the rest of the code).
//Declaration
double bal = 0;
double intrst = 0;
//Captures input
Scanner scan = new Scanner(System.in);
System.out.print("Current Balance: ");
bal = scan.nextDouble();
//Just explains intrst value
if(late == true)
if(lvl.equalsIgnoreCase(royal)) intrst = .022;
else if(lvl.equalsIgnoreCase(gentry)) intrst = .028;
else if(lvl.equalsIgnoreCase(common)) intrst = .03;
else
{
System.out.println();
System.out.print("Unknown customer level ");
System.out.print("\"" + lvl + "\"");
System.exit(1);
}
double minPay = (bal * 0.03);
double totalMinPay = (minPay + lateFee) + (intrst * bal);
System.out.println("Card Balance: $" + bal);
System.out.println("Minimum payment to principle (3% of principle): $" + (minPay));
System.out.println("Minimum total payment (payment and fees): $" + totalMinPay);