First Homework Assignment - Sales Tax Program Purpose Calculate total price including tax Flowchart Pseudocode Function Main Declare Real StateTax

# First Homework Assignment - Sales Tax Program Purpose...

• 2
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 2 out of 2 pages.

Sales Tax Program Purpose Calculate total price including tax Flowchart
Pseudocode Function Main Declare Real StateTax, Purchase, CountyTax, TotalSaleTax, TotalSale Output "Enter amount of purchase" Input Purchase Assign StateTax = Purchase *0.04 Output "The state tax is:"&StateTax&"." Assign CountyTax = Purchase *0.02 Output "The county tax is:"&CountyTax&"." Assign TotalSaleTax = StateTax+CountyTax Output "The total sale tax is:"&TotalSaleTax&"." Assign TotalSale = Purchase+TotalSaleTax Output "The total sale is"&TotalSale&"." End Source Code import java.util.*; import java.lang.Math; public class TotalSales { private static Scanner input = new Scanner(System.in); public static void main(String[] args) { double stateTax, purchase, countyTax, totalSaleTax, totalSale; System.out.println("Enter amount of purchase"); purchase = input.nextDouble(); stateTax = purchase * 0.04; System.out.println("The state tax is:" + stateTax + "."); countyTax = purchase * 0.02; System.out.println("The county tax is:" + countyTax + "."); totalSaleTax = stateTax + countyTax; System.out.println("The total sale tax is:" + totalSaleTax + "."); totalSale = purchase + totalSaleTax; System.out.println("The total sale is" + totalSale + "."); } } Sample Execution run: Enter amount of purchase 100 The state tax is:4.0. The county tax is:2.0. The total sale tax is:6.0. The total sale is106.0. BUILD SUCCESSFUL (total time: 14 seconds)