cannot be applied to (double,java.lang.String)
I am working on a small and simple program but are stuck and need help I know that it's simple but hard to find the way for it to compile if any one out there is helpfull I would really appreciate it very much.
import java.text.NumberFormat;
import java.util.Scanner;
public class CodedInvoiceApp
{
public static void 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/t): ");
String customerType = sc.next();
if (customerType.equalsIgnoreCase ("R"))
if (customerType.equalsIgnoreCase ("C"))
if (customerType.equalsIgnoreCase ("T"))
//call the coded invoice method
System.out.print("Enter subtotal:");
double subtotal = sc.nextDouble();
//call the discountPecent method
double discountPercent = getDiscountPercent(subtotal,customerType);
if (customerType.equalsIgnoreCase("R"))
{
if (subtotal < 250)
discountPercent = 0;
else if (subtotal >= 250 && subtotal < 500)
discountPercent = .25;
else if (subtotal >= 500)
discountPercent = .30;
}
else if (customerType.equalsIgnoreCase("C"))
discountPercent = .2;
else if (customerType.equalsIgnoreCase("T"))
if (subtotal < 500)
discountPercent = .4;
else if (subtotal >= 500)
discountPercent = .5;
// calculate the discount amount and total
double discountAmount = subtotal * discountPercent;
double total = subtotal - discountAmount;
// format and display the results
NumberFormat currency = NumberFormat.getCurrencyInstance();
NumberFormat percent = NumberFormat.getPercentInstance();
System.out.println(
"Discount percent: " + percent.format(discountPercent) + "\n" +
"Discount amount: " + currency.format(discountAmount) + "\n" +
"Total:" + currency.format(total) + "\n");
// see if the user wants to continue
System.out.print("Continue? (y/n): ");
choice = sc.next();
System.out.println();
}
}
// a static method that requires three arguments and returns a double
private static double getDiscountPercent(double subtotal,double customerType)
{
double discountPercent = 0.0;
double discountAmount = subtotal * discountPercent;
return subtotal;
}
}
java:28: getDiscountPercent(double,double) in CodedInvoiceApp cannot be applied to (double,java.lang.String)
double discountPercent = getDiscountPercent(subtotal,customerType);
Again thanks very much in advance

