VAR choix : char ;
entree, plat, fin, chaude, froide : string[30]
;
facture, supplement, prixchaude, prixfroide : real ;
BEGIN
(* presentation *)
writeln('Le Grand Restaurant') ;
writeln('service a toute heure') ;
writeln ;
write('Menu obligatoire : ') ;
writeln ('entrée - plat garni - fromage ou dessert')
;
writeln('15 euro (boissons non comprises)') ;
writeln ;
(*choix de l'entree'*) ;
writeln('VOTRE ENTREE :') ;
writeln('-1- salade du chef') ;
writeln('-2- charcuterie') ;
writeln('-3- pounti') ;
writeln('-0- pas d''entrée') ;
repeat
write('votre choix ? ') ; readln(choix)
;
until ((choix>='0') and (choix<='3'));
case choix of
'1' : entree:='salade du chef' ;
'2' : entree:='charcuterie' ;
'3' : entree:='pounti' ;
else entree:='' ;
end ;
(* choix du plat *)
writeln('VOTRE PLAT :') ;
writeln('-1- truffade') ;
writeln('-2- coq au vin') ;
writeln('-3- sole meunière') ;
writeln('-0- pas de plat') ;
repeat
write('votre choix ? ') ; readln(choix)
;
until ((choix>='0') and (choix<='3'))
;
case choix of
'1' : plat:='truffade' ;
'2' : plat:='coq au vin' ;
'3' : plat:='sole meunière' ;
'0' : plat:='' ;
end ;
(* fromage ou dessert *)
supplement:=0 ;
repeat
write('fromage ou dessert (f|d) ? ')
; readln(choix) ;
until (upcase(choix)='F') or (upcase(choix)='D')
;
if upcase(choix)='F'
then fin:='fromage'
else begin
fin:='dessert ' ;
writeln('VOTRE
DESSERT : ') ;
writeln('-1- crème caramel') ;
writeln('-2- glace vanille') ;
writeln('-3- profiterolles (supplément 1.00
euro)') ;
writeln('-0- pas de dessert') ;
repeat
write('votre choix ? ') ; readln(choix) ;
until ((choix>='0') and (choix<='3')) ;
case choix
of
'1' : fin:=fin+'(crème caramel)' ;
'2' : fin:=fin+'(glace vanille)' ;
'3' : begin fin:=fin+'(profiterolles)' ; supplement:=1.00 ; end ;
end ;
end ;
(* choix des boissons *)
(* boissons chaudes *)
chaude:='' ; prixchaude:=0 ;
writeln('voulez-vous une boisson chaude (o|n) ? ') ;
readln(choix) ;
if (upcase(choix)='O') then
begin
writeln('-1- café') ;
writeln('-2- thé') ;
writeln('-3- infusion') ;
repeat
write('votre choix ? ') ; readln(choix) ;
until ((choix>='1') and (choix<='3')) ;
case choix of
'1' : begin chaude:='café' ; prixchaude:=1.00
; end ;
'2' : begin chaude:='thé' ; prixchaude:=1.50
; end ;
'3' : begin chaude:='infusion' ; prixchaude:=1.50
; end ;
end ;
end;
(* boissons froides *)
froide:='' ; prixfroide:=0 ;
writeln('voulez-vous une boisson froide (o|n) ? ') ;
readln(choix) ;
if (upcase(choix)='O') then
begin
writeln('-1- eau minérale') ;
writeln('-2- vin') ;
writeln('-3- bière') ;
repeat
write('votre choix ? ') ; readln(choix) ;
until ((choix>='1') and (choix<='3')) ;
case choix of
'1' : begin froide:='eau minérale' ; prixfroide:=1.70
; end ;
'2' : begin froide:='vin' ; prixfroide:=11.00 ;
end ;
'3' : begin froide:='bière' ; prixfroide:=2.50
; end ;
end ;
end;
(* edition de la facture *)
(* le client n'a pas pu se tromper car tous les choix
sont controlés *)
facture:=0 ;
writeln ;
writeln('------------------------------------') ;
writeln('LE GRAND RESTAURANT') ;
writeln ;
writeln('votre facture du 17/10/01 :') ;
writeln ;
writeln('Un menu à (euro)
':30,'15.00':6) ;
facture:=15 ;
writeln('Entrée choisie : ',entree) ;
writeln('Plat choisi : ', plat) ;
writeln('fromage ou dessert : ') ;
writeln(fin) ;
writeln ;
if supplement>0 then
begin
writeln('supplement':30,supplement:6:2) ;
facture:=facture+supplement ;
end ;
if prixchaude>0 then
begin
writeln(chaude:30,prixchaude:6:2) ;
facture:=facture+prixchaude ;
end ;
if prixfroide>0 then
begin
writeln(froide:30,prixfroide:6:2) ;
facture:=facture+prixfroide ;
end ;
writeln ;
writeln('total : ':30, facture:6:2) ;
writeln ;
writeln('merci de votre visite') ;
writeln('------------------------------------') ;
END.