import java.util.Scanner;
import java.text.NumberFormat;

public class InvoiceApp
{
   public static voice main(String[] args)
   {
     Scanner sc = new Scanner(System.in);
     String choice = "y";

     while (!choice.equalsIgnoreCase("n"))
     {
       // get the input from the user
       System.out.print("Enter customer type (r/c): ");
       String customerType = sc.next();
       System.out.print("Enter subtotal: ");
       double subtotal = sc.nextDouble();

       // get the discount percent
       double discountPercent = 0.0;
       if (customerType.equalsIgnoreCase("R"))
       {
          if (subtotal < 100)
              discountPercent = 0;
          else if (subtotal >= && subtotal < 250)
              discountPercent = .1;
          else if (subtotal >= 250)
              discountPercent = .2;
       }
       else if (customerType.equalsIgnoreCase("C"))
       {
            if (subtotal < 250)
                discountPercent = .2;
            else 
                discountPercent = .3;
       }
       else 
                discountPercent = .1;
       // the code to calculate, format, and display results goes here

      // the code to see if the user wants to continue goes here
     }
 
   }
}


*******************************************************

output:


Enter customer type (r/c):   r
Enter subtotal:     100
Discount percent:   10%
Discount amount:    $10.00
Total:              $90.00

Continue? (y/n):



*******************************************************




Site hosted by Angelfire.com: Build your free website today!