I have this very simple program which calculates and displays the price of a product after sales tax has been added.
public class FindCost
public static void main (String args )
double price, tax;
System.out.println("*** Product Price Check ***");
System.out.print("Enter initial price: "); //prompt for input
price = EasyIn.getDouble(); //input method called
System.out.print("Enter tax rate: "); //prompt for input
tax = EasyIn.getDouble(); //input method called
price = price * (1 + tax/100);
System.out.println("Cost after tax = " + price);
I want to ammend the program so that:
- all currency values are displayed to two decimal places;
- line and tab spaces are used to improve the layout of the information displayed
Whats the best way to do this in the code?