import javax.swing.JOptionPane;
public class Minutes {
public static void main(String[] args) {
double BasePlanCost = 20;
final double BaseCos
Try to organize your message as:
String message = String.format(
"**IST Wireless Receipt** \n" +
" Base Plan Cost:$ %.2f \n" +
" Cost For Minutes Used: $ %.2f \n" +
" Grand Total : $ %.2f", BasePlanCost, CostForMinutes, GrandTotal);
JOptionPane.showMessageDialog(null, message);
I recommended you to read the code conventions of the java language
http://www.oracle.com/technetwork/java/codeconventions-135099.html
You have
String.format("$%.2f","**IST Wireless Receipt**",
This means you want to format the second argument which is a String using %.2f
which is a float format which won't work.
You need to re-organize your format to be first and the values you want to format after it.
String.format("**IST Wireless Receipt**%n" +
"Base Plan Cost: $%.2f%n" +
"Cost For Minutes Used: $%.2f%n" +
"Grand Total: $%.2f%n",
BasePlanCost, CostForMinutes, GrandTotal)