FOR C# Write if-else-if statements that assign the correct value to discount , u
ID: 3908665 • Letter: F
Question
FOR C#
Write if-else-if statements that assign the correct value to discount, using the logic described below: Assume variables price, dept, discount are properly declared.
a. Assign 0.20 to discount if dept equals to 5 and price is $100 or more.
b. Assign 0.15 to discount if dept is anything else and price is $100 or more.
c. Assign 0.10 to discount if dept equals 5 and price is less than $100.
d. Assign 0.05 to discount if dept is anything else and price is less than $100.
Explanation / Answer
if(dept==5 && price>=100){ discount = 0.20; } else if(price >= 100){ discount = 0.15; } else if(dept==5 && priceRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.