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
- Quantum computer?
- Quantum Numbers!!?
- how many quantum states are there with n=3?
- JUGs????????????
- what is the difference between quarter horse bar and full horse bars in terms of saddle?
- Fastest Horse (Poll)?
- Quartz for Money?
- 97 audi a4 2.8l, quattro system?!?!?
- WWE Championship?
- how often should you change the tires on your car?
Related Items
- .45 Full Moon Chargers (10 Quantity) free s&h
- Martial Art Certificates (quantity of 20) ~*Kenpo*~
- Super Glow Red # 4 Moon Glow Jigs. Quantity:12 jigs/bag
- 8 1/2" ULTRA-GRADE* Trampoline Springs,Quantity 24
- 7" New *ULTRA-GRADE* Trampoline Springs, Quantity of 24
- *ULTRA-GRADE* Trampoline Safety Foam Poles, Quantity 24
- 5 1/2" New *ULTRA-GRADE* Trampoline Springs,Quantity 24
- *ULTRA-GRADE* Trampoline Safety Foam Poles, Quantity 18
- Super Glow Red # 4 Moon Glow Jigs. Quantity:12 jigs/bag
- Super Glow Red # 6 Moon Glow Jigs. Quantity:12 jigs/bag
- Jagwire Brake Inner Wires 1.6 x 1700mm / Quantity 10
- Crank Brothers Tire Levers / Speed Levers / Quantity 2
- Universal Bicycle Tube Patch Kits / Quantity 5
- Road Brake Inner Wires 75" Quantity 4
- TRAMPOLINE SPRINGS, 7" LONG, QUANTITY 10, ALL NICE
- ANODIZED ALUMINUM DIN PLUGS QUANTITY: 1 311-1
- ANODIZED ALUMINUM DIN PLUGS QUANTITY: 3 311-4
- ANODIZED ALUMINUM DIN PLUGS QUANTITY: 5 311-5
- Used Tennis Balls Nice Indoor Country Club 50 Quantity
- Frogg Toggs Chilly Pad- NEW- Quantity 2
- Broomhandle Mauser Strippers New (5 quantity)
- Yakima Control Tower Roof Rack Tower (quantity 4) $130
- Emergency Survival Blankets For Warmth!! Any Quantity!
- Billiard Pool Table Spots / Dots Quantity of 20
- Quantity 50 BRASS DOWNRIGGER EYES
- BSB Swiss Speed Skate Bearings 608 8mm - Quantity 16
- BSB Swiss Speed Skate Bearings 608 8mm - Quantity 20
- SALE! Taxidermy Reference Photo CD's - Quantity Price
- SALE! Taxidermy Reference Photo CD's - Quantity Price
- Musky Fish - Decal - Sticker - Quantity 2 - 6.75" Long