Visual C# question?

Question: there is a logical error in my if statement if (quantity < 20) { unitPrice = 20; if (quantity < 50) { unitPrice = 15; } if (quantity < 100) { unitPrice = 12; } if (quantity < 500) { unitPrice = 8; } } else { unitPrice = 5; }

Answer: The corrected code. if (quantity < 20) { unitPrice = 20; } else if (quantity < 50) { unitPrice = 15; } else if (quantity < 100) { unitPrice = 12; } else if (quantity < 500) { unitPrice = 8; } else { unitPrice = 5; }

Related Questions

Related Items