Bill of Sale

Run Settings
LanguageJava
Language Version
Run Command
/* *This program calculate the bill of sale *It shows the price before and after tax *as well as the change given back */ class Main { public static void main(String[] args) { //determine the variables double ogPrice, HST, totalCost, costafterTax, change, salesTax, mGiven; //give variables a value ogPrice=12.49; HST=0.13; salesTax= 1.62; mGiven=20; String strDouble = String.format("%.2f", 5.890000000000001); //calcultions totalCost=ogPrice*HST; costafterTax=ogPrice+salesTax; change=mGiven-costafterTax; //print output System.out.println("The bill of sale is $"+ogPrice+" for the price before tax."); System.out.println("The cost after tax is $"+costafterTax+"."); System.out.println("The amount given is $"+ mGiven+" so the change is $"+strDouble+"."); } }
Editor Settings
Theme
Key bindings
Full width
Lines