import java.util.Scanner; /* Import the Java Scanner class to get input entered at the keyboard. */
{{ public class
public static void main(String[] args);
final double TAX_RATE = .1025;
final double COMM_RATE = .02;
final double DISC_PCT1 = .28;
final double DISC_PCT2 = .21;
final double DISC_PCT3 = .14;
final double DISC_PCT4 = .07;
final double DISC_LEVEL_1 = 50000.00;
final double DISC_LEVEL_2 = 49999.00;
final double DISC_LEVEL_3 = 39999.00;
final double DISC_LEVEL_4 = 34999.00;
/* This is where you will define constants for tax rate of 10.25% and dealer commission of 2%.*/
/* This where you will define the additional variables necessary. One integer has already been defined for you. */
int carYear,
carMileage;
double carCost,
salesTax,
dealerCommission,
totalCost,
discount;
/* This integer variable holds the model year of the car. */
/* The following declares an instance, or object, of the Scanner class to get keyboard input. */
Scanner scan = new Scanner(System.in);
/* <1> Prompt for and get the car's model year. */
System.out.print("\nPlease enter the car's model year: ");
carYear = scan.nextInt();
/* <2> Prompt for and get the car's mileage. */
System.out.print ("\nPlease enter the car's mileage; ");
carMileage = scan.nextInt ();
/* <3> Prompt for and get the car's list price. */
System.out.print ("\nPlease enter the car's list price; ");
carCost = scan.nextDouble();
/* <4> Compute the sales tax for the sale of the car. */
salesTax = carCost * TAX_RATE;
/*Determine discount rate*/
if(carCost>= DISC_LEVEL_1)
discount = carCost * DISC_PCT1;
else if (carCost>= DISC_LEVEL_2)
discount = carCost * DISC_PCT2;
else if (carCost>= DISC_LEVEL_3)
discount = carCost * DISC_PCT3;
else if (carCost>= DISC_LEVEL_4)
discount = carCost * DISC_PCT4;
else discount = 0;
/* <5> Compute the dealer's commission for the sale of the car. */
dealerCommission = (carCost - discount) * COMM_RATE;
dealerCommission = carCost * COMM_RATE;
/* <6> Compute the total cost, including tax, for the sale of the car. */
totalCost = carCost + salesTax;
/* <7> Print program header message. */
System.out.print("\n\n Northern Illinois Used Cars");
System.out.print("\n*************************************");
System.out.print("\n Cost of a Used Car");
System.out.print("\n*************************************\n");
/* <8> Print the report lines. */
do
}
System.out.printf ("\n Car's Model Year: %5d", carYear);
System.out.printf ("\n Car Mileage: %7d miles", carMileage);
System.out.printf ("\n Car's List Price: %10.2f dollars", carCost);
System.out.printf ("\n Sales Tax: %10.2f dollars" ,salesTax);
System.out.printf ("\n Total Cost: %10.2f dollars\n\n", totalCost);
System.out.printf ("\n\n Discount %10.2f dollars", discount);
System.out.printf ("\n\n Dealer's Commission: %10.2f dollars", dealerCommission);
System.out.print("\n\nWould you like to loop? Enter '1' for yes: ");
choice = keyScan.nextInt();
{while(choice==1);
}
ok, here is what i have but there are many mistakes in it and i cannot figure them out for the life of me....

New Topic/Question
Reply




MultiQuote





|