lundi 2 mars 2015

Stuck on writing a simple method with an if statment

Hi basically I need to write a method to calculate the price of Shirts The first 10 Shirts ordered are charged at $20 per Shirt and then any shirt after are charged at $15 per Shirt. Would any one be able to help me work this out this is what I have so far thanks.



public static double calculateCost(int ShirtsOrdered) {
double cost = 0.0;

if (ShirtsOrdered <= 10) {
cost = cost + 20.00 * ((ShirtsOrdered) / 1);


} else if ((ShirtsOrdered > 10) {
cost = cost + 15.00 * ((ShirtsOrdered) / 1);



return cost;
}

Aucun commentaire:

Enregistrer un commentaire