Value Added Tax and Total Sales Tax Essay

750 Words3 Pages
Unit 3 Assignment 1: Homework Short Answer 5, 6 p. 71 5. What two things must you normally specify in a variable declaration? You must specify the variable type and identifier. 6. What value is stored in uninitialized variables? Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values. Algorithm Workbench Review Questions 3-10 p.71 3. Write assignment statements that perform the following operations with the variables a, b, and c. a. Adds 2 to a and stores the result in b Set b= 2 +a b. Multiplies b times 4 and stores the result in a set a= b*4 c. Divides a by 3.14 and stores the result in b set b= 3.14/b d. Subtracts 8 from b…show more content…
Sales tax Design a program that will ask the user to enter the amount of purchase. The program should then compute the state and country sales tax. Assume the state sales tax is 4 percent and the country sales tax is 2 percent. The program should display the amount of purchase, the state sales tax, the country sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax). Hint use the value 0.02 to represent the 2 percent, and 0.04 to represent 4 percent. public class SalesTax { public static void main(String[] args) { double price; price = 100.00; System.out.println("The price of the item is " + price); double value1 = 0.02; double state_tax = value1 * price; System.out.println("The state tax on the item is $ " + state_tax); double value2 = 0.04; double county_tax = value2 * price; System.out.println("The county tax on the item is $" + county_tax); double total_sales_tax = state_tax + county_tax; System.out.println("The total sales tax on the item is $" + total_sales_tax); double total_sale_of_item = total_sales_tax + price; System.out.println("The total sale of the item is $" + total_sale_of_item); } } 8. Tip, Tax, and Total Design a program that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, and then calculate the amount of a 15 percent tip and 7 percent sales tax. Display each of

More about Value Added Tax and Total Sales Tax Essay

Get Access