Answer to Question #8694 in Delphi | Pascal for berry

Question #8694
write a pascal Program with procedure called Calculatediscount that caluculates the actual discounted price based on the day number input. the program must output the corrisponding day of the week and the price for the day?
1
Expert's answer
2012-04-27T07:55:24-0400
Program calculates discount depending on day of week. User inputs day number from 1 to 7 and price. Output data is day from Monday to Sunday and calculated price.
price=(10-daynumber)/10*price. It means that Monday(10%),Tuesday(20%) … For example
day=5 price =120 output: Friday 60.



program discount;
var day :real; price :real;
procedure calculatediscount(day:real;price:real);
var c:string;
begin
if day=1 then c:='Monday' else if
day=2 then c:='Tuesday' else if
day=3 then c:='Wednesday' else if
day=4 then c:='Thursday' else if
day=5 then c:='Friday' else if
day=6 then c:='Saturday' else if
day=7 then c:='Sunday';

price:=(10-day)/10*price;
writeln('on ',c,' price is ',price);
end;
begin
writeln('enter a day from monday=1 to sunday=7 and price');
readln(day,price);
calculatediscount(day,price);
readln
end.

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS