Java Programming Help?

ok this is my program
import java.util.Scanner;
public class Assign6{
public static final double rate=1.50;
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
// welcome message for input
System.out.println(“Welcome to the pricing system”);
// Price entered for item
System.out.println(“Please enter the item’s price: “);
// Item’s price to be entered by user.
System.out.print (“Enter the item’s price”);
// double variable for price
double price=sc.nextDouble();
// double variable for salestax1
double SalesTax1=price*.0150;
// double variable for salestax2
double SalesTax2=price*.0250;
// double variable for salestax3
double SalesTax3=price*.0350;
// double variable for salestax4
double SalesTax4=price*.0400;
System.out.println(“Price: \t”+price);
// conditional statement for the sales tax
if (price>= 200.00) { // if ‘price’ is greater than or equal to 100
System.out.printf(“Salestax1: %.2f\n”,(price*0.0150));
} else { // if it’s not
System.out.printf(“Salestax2: %.2f\n”,(price*0.0250));
} else { // if it’s not
System.out.printf(“Salestax3: %.2f\n”,(price*0.0350));
else { // if it’s not
System.out.printf(“Salestax2: %.2f\n”,(price*0.04));
System.out.println(“—————-“)…
// conditional statement for the total
if (price >= 100) { // if ‘price’ is greater than or equal to 100
System.out.printf(“Total: %.2f \n”,(price+SalesTax1));
} else { // if it’s not
System.out.printf(“Total: %.2f \n”,(price+SalesTax2));
}
}
}
this builds off of a previous program, in the previous program i had 2 tax rates one for %7.25 and one for %3.50
when i entered a price into the compiler output for 100 dollars or more it would use the 7.25 tax rate, under 100 dollars would be the 3.50
my new assignment is asking me to make these changes
1) Add a third constant for a third tax rate and a fourth constant for a fourth tax rate. Name each appropriately. The four tax rates will be 1.5%, 2.5%, 3.5% and 4%.
2) After prompting and getting the price of the item, charge the highest tax rate if the price is 0.00 < price < 50.00, the second highest tax rate if the price is 50.00 <= price < 100.00, the third highest tax rate if the price is 100.00 <= price = 200.00. Hint: Use a cascading if structure going from highest dollar amount to lowest.
3) Display everything exactly as before.
i keep getting stuck at the public final static double rate, need help

Both comments and pings are currently closed.

Comments are closed.

Powered by WordPress | Designed by: free css template | Thanks to hostgator coupon and web hosting reviews