Hello
I feel like this might be a stupid question as I am very new to
JAVA and I am having quite a bit of difficulty writing a progam, but I am going to ask it anyway. Can you call a different method based upon what a user inputs from within a method using if ,else if statements... here's an example if it helps. I guess one my questions is why can't I just call the method without parameters for example, computeNoDiscount() Any help would be very much appreciated. Thanks.
public static double calculatePrice(double retailPrice, double numOrdered, char discountType) {
if (discountType == 'n')
computeNoDiscount(retailPrice, numOrdered);
else if (discountType == 'c')
computeCouponDiscount(retailPrice, numOrdered);
else if (discountType == 'f')
computeFreeShipDiscount(retailPrice, numOrdered);
else if (discountType == 's')
computeSpecialDiscount(retailPrice, numOrdered);
double fpr;
fpr = retailPrice * numOrdered;
return fpr;