Question #310704

A company manufactures three products: Engines, Pumps and Fans. They give a discount

of 10% on order for engines if the order is for Rs.5,000 or more. The same discount of

10% is given on pump orders of values of Rs.2,000 or more and on fan orders for

Rs.1,000 or more. On all other orders they do not give any discount.


Expert's answer

engin = input('Engines order: ');
enginDiscount = 0;
if engin >= 5000 
    enginDiscount = 0.1 * engin;
end
pump = input('Pump order: ');
pumpDiscount = 0;
if pump >= 2000
    pumpDiscount = 0.1*pump;
end
fun = input('Fun order: ');
funDiscount = 0;
if fun >= 1000
    funDiscount = 0.1*fun;
end
fprintf("Engines: Rs.%.2f discount Rs.%.2f\n", engin, enginDiscount);
fprintf("Pumps:   Rs.%.2f discount Rs.%.2f\n", pump, pumpDiscount);
fprintf("Funs:    Rs.%.2f discount Rs.%.2f\n", fun, funDiscount);
total = engin + pump + fun;
totalDiscount = enginDiscount + pumpDiscount + funDiscount;
fprintf("-----------------------------------------------\n");
fprintf("Total:   Rs.%.2f total discount Rs.%.2f\n", total, totalDiscount);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS