ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT
Latest Users' Questions
User Submitted Source Code!
Description:
PIZZA
Language: PASCAL
Code:
PIZZA
Language: PASCAL
Code:
program pizza;
{The Tolan8r}
uses Crt;
label extra;
const
fixedcost = 3.70;
basecost = 2.00;
extracost = 1.00;
var
size,area,cost,sellingCost : real;
siz, typename : string;
ingred, pizzatype : integer;
begin
clrscr; {This block is the title screen}
gotoxy(30,3);
textcolor(blue);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(30,10);
textcolor(7);
writeln ('------------------');
gotoxy(30,11);
textcolor(10);
writeln ('pizza cost program');
gotoxy(30,12);
textcolor(7);
writeln ('------------------');
gotoxy(29,16);
textbackground(1);
writeln ('press enter to start');
gotoxy(28,17);
readln;
textbackground(black);
clrscr;
{input}
{This block is where they can choose what type pizza}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(28,10);
textcolor(7);
writeln ('----------------------');
gotoxy(28,11);
textcolor(10);
writeln ('select your pizza type');
gotoxy(28,12);
textcolor(7);
writeln ('----------------------');
gotoxy(28,13);
Writeln('press 1 for meat');
gotoxy(28,14);
Writeln('press 2 for chicken');
gotoxy(28,15);
Writeln('press 3 for vegetarian');
gotoxy(28,16);
Writeln('press 4 for cheese');
gotoxy(28,17);
Writeln('press 5 for peperoni');
gotoxy(28,18);
Writeln('press 6 for ham and pineapple');
gotoxy(30,19);
writeln('type:');
gotoxy(37,19);
textcolor(10);
Readln(pizzatype);
gotoxy(27,20);
textcolor(10);
If pizzatype = 1 then writeln('you have chosen meat');
If pizzatype = 2 then writeln('you have chosen chicken');
If pizzatype = 3 then writeln('you have chosen vegetarian');
If pizzatype = 4 then writeln('you have chosen cheese');
If pizzatype = 5 then writeln('you have chosen peperoni');
If pizzatype = 6 then writeln('you have chosen ham and pineapple');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
gotoxy(28,24);
readln;
textbackground(black);
clrscr;
{This block is where they can choose what size pizza}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(28,10);
textcolor(7);
writeln ('----------------------');
gotoxy(28,11);
textcolor(10);
writeln('select your pizza size');
gotoxy(28,12);
textcolor(7);
writeln ('----------------------');
gotoxy(28,13);
Writeln('press 1 for size small');
gotoxy(28,14);
Writeln('press 2 for size medium');
gotoxy(28,15);
Writeln('press 3 for size large');
gotoxy(28,16);
Writeln('press 4 for extra large');
gotoxy(36,17);
writeln('size:');
gotoxy(43,17);
textcolor(10);
Readln(size);
if (size > 4) or (size < 1) then
begin
gotoxy(22,18);
textcolor(yellow);
writeln ('Invalid size pizza, please enter 1-4');
textcolor(7); gotoxy(28,20);
gotoxy(36,19);
writeln('size:');
gotoxy(43,19);
textcolor(10);
readln (size);
end;
gotoxy(26,20);
textcolor(7);
If size = 1 then writeln('you have chosen small');
If size = 2 then writeln('you have chosen medium');
If size = 3 then writeln('you have chosen large');
If size = 4 then writeln('you have chosen extra large');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
gotoxy(26,23);
readln;
textbackground(black);
clrscr;
If size = 1 then siz := 'small';
If size = 2 then siz := 'medium';
If size = 3 then siz := 'large';
If size = 4 then siz := 'extra large';
If pizzatype = 1 then typename := 'meat';
If pizzatype = 2 then typename := 'chciken';
If pizzatype = 3 then typename := 'vegetarian';
If pizzatype = 4 then typename := 'cheese';
If pizzatype = 5 then typename := 'peperoni';
If pizzatype = 6 then typename := 'pineapple';
{This block is where they can choose what extra ingredients to add}
extra:
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(25,10);
textcolor(7);
writeln ('-----------------------------');
gotoxy(25,11);
textcolor(10);
writeln('select your extra ingredients');
gotoxy(25,12);
textcolor(7);
writeln ('-----------------------------');
gotoxy(22,14);
writeln ('extra ingredients are 50 cents each,');
gotoxy(21,15);
writeln ('you can add up to 3 extra ingredients');
gotoxy(28,17);
writeln('extra ingredients:');
gotoxy(47,17);
textcolor(10);
readln (ingred);
if (ingred > 3) or (ingred < 0) then
begin
gotoxy(13,18);
textcolor(yellow);
writeln ('Invalid number of extra ingredients, please enter 0-3');
textcolor(7); gotoxy(28,19);
writeln('extra ingredients:');
gotoxy(47,19);
textcolor(10);
readln (ingred);
end;
gotoxy(11,20);
textcolor(7);
writeln('you have added ', ingred , ' extra ingredients to your ', siz, ' pizza');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
readln;
{processing}
area := size*1.3;
cost := fixedcost + (basecost*area) + (ingred*extracost);
sellingcost := cost * 1.35;
{output}
textbackground(black);
clrscr;
{This block is where it shows the cost}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(30,10);
textcolor(7);
writeln ('-------------------');
gotoxy(30,11);
textcolor(10);
writeln ('total cost of pizza');
gotoxy(30,12);
textcolor(7);
writeln ('-------------------');
gotoxy(26,10);
writeln;
gotoxy(26,11);
writeln;
gotoxy(5,14);
textcolor(7);
writeln('you have ordered one ', siz ,' ',typename , ' pizza with ', ingred , ' extra ingredients');
gotoxy(22,16);
writeln ('The total cost of this pizza is:');
gotoxy(55,16);
textcolor(10);
writeln ('$', sellingCost:0:2);
gotoxy(28,19);
textbackground(1);
textcolor(7);
writeln ('Press any key to exit...');
while not keypressed do; {Waits for a key to be pressed}
end
{The Tolan8r}
uses Crt;
label extra;
const
fixedcost = 3.70;
basecost = 2.00;
extracost = 1.00;
var
size,area,cost,sellingCost : real;
siz, typename : string;
ingred, pizzatype : integer;
begin
clrscr; {This block is the title screen}
gotoxy(30,3);
textcolor(blue);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(30,10);
textcolor(7);
writeln ('------------------');
gotoxy(30,11);
textcolor(10);
writeln ('pizza cost program');
gotoxy(30,12);
textcolor(7);
writeln ('------------------');
gotoxy(29,16);
textbackground(1);
writeln ('press enter to start');
gotoxy(28,17);
readln;
textbackground(black);
clrscr;
{input}
{This block is where they can choose what type pizza}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(28,10);
textcolor(7);
writeln ('----------------------');
gotoxy(28,11);
textcolor(10);
writeln ('select your pizza type');
gotoxy(28,12);
textcolor(7);
writeln ('----------------------');
gotoxy(28,13);
Writeln('press 1 for meat');
gotoxy(28,14);
Writeln('press 2 for chicken');
gotoxy(28,15);
Writeln('press 3 for vegetarian');
gotoxy(28,16);
Writeln('press 4 for cheese');
gotoxy(28,17);
Writeln('press 5 for peperoni');
gotoxy(28,18);
Writeln('press 6 for ham and pineapple');
gotoxy(30,19);
writeln('type:');
gotoxy(37,19);
textcolor(10);
Readln(pizzatype);
gotoxy(27,20);
textcolor(10);
If pizzatype = 1 then writeln('you have chosen meat');
If pizzatype = 2 then writeln('you have chosen chicken');
If pizzatype = 3 then writeln('you have chosen vegetarian');
If pizzatype = 4 then writeln('you have chosen cheese');
If pizzatype = 5 then writeln('you have chosen peperoni');
If pizzatype = 6 then writeln('you have chosen ham and pineapple');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
gotoxy(28,24);
readln;
textbackground(black);
clrscr;
{This block is where they can choose what size pizza}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(28,10);
textcolor(7);
writeln ('----------------------');
gotoxy(28,11);
textcolor(10);
writeln('select your pizza size');
gotoxy(28,12);
textcolor(7);
writeln ('----------------------');
gotoxy(28,13);
Writeln('press 1 for size small');
gotoxy(28,14);
Writeln('press 2 for size medium');
gotoxy(28,15);
Writeln('press 3 for size large');
gotoxy(28,16);
Writeln('press 4 for extra large');
gotoxy(36,17);
writeln('size:');
gotoxy(43,17);
textcolor(10);
Readln(size);
if (size > 4) or (size < 1) then
begin
gotoxy(22,18);
textcolor(yellow);
writeln ('Invalid size pizza, please enter 1-4');
textcolor(7); gotoxy(28,20);
gotoxy(36,19);
writeln('size:');
gotoxy(43,19);
textcolor(10);
readln (size);
end;
gotoxy(26,20);
textcolor(7);
If size = 1 then writeln('you have chosen small');
If size = 2 then writeln('you have chosen medium');
If size = 3 then writeln('you have chosen large');
If size = 4 then writeln('you have chosen extra large');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
gotoxy(26,23);
readln;
textbackground(black);
clrscr;
If size = 1 then siz := 'small';
If size = 2 then siz := 'medium';
If size = 3 then siz := 'large';
If size = 4 then siz := 'extra large';
If pizzatype = 1 then typename := 'meat';
If pizzatype = 2 then typename := 'chciken';
If pizzatype = 3 then typename := 'vegetarian';
If pizzatype = 4 then typename := 'cheese';
If pizzatype = 5 then typename := 'peperoni';
If pizzatype = 6 then typename := 'pineapple';
{This block is where they can choose what extra ingredients to add}
extra:
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(25,10);
textcolor(7);
writeln ('-----------------------------');
gotoxy(25,11);
textcolor(10);
writeln('select your extra ingredients');
gotoxy(25,12);
textcolor(7);
writeln ('-----------------------------');
gotoxy(22,14);
writeln ('extra ingredients are 50 cents each,');
gotoxy(21,15);
writeln ('you can add up to 3 extra ingredients');
gotoxy(28,17);
writeln('extra ingredients:');
gotoxy(47,17);
textcolor(10);
readln (ingred);
if (ingred > 3) or (ingred < 0) then
begin
gotoxy(13,18);
textcolor(yellow);
writeln ('Invalid number of extra ingredients, please enter 0-3');
textcolor(7); gotoxy(28,19);
writeln('extra ingredients:');
gotoxy(47,19);
textcolor(10);
readln (ingred);
end;
gotoxy(11,20);
textcolor(7);
writeln('you have added ', ingred , ' extra ingredients to your ', siz, ' pizza');
gotoxy(28,22);
textbackground(1);
textcolor(7);
writeln ('press enter to continue');
readln;
{processing}
area := size*1.3;
cost := fixedcost + (basecost*area) + (ingred*extracost);
sellingcost := cost * 1.35;
{output}
textbackground(black);
clrscr;
{This block is where it shows the cost}
gotoxy(30,3);
textcolor(yellow);
writeln(' __ ');
gotoxy(30,4);
writeln(' // ""--.._ ');
gotoxy(30,5);
writeln('|| (_) _ "-._ ');
gotoxy(30,6);
writeln('|| _ (_) -. ');
gotoxy(30,7);
writeln('|| (_) __..-/ ');
gotoxy(30,8);
writeln(' __..--"" ');
gotoxy(30,10);
textcolor(7);
writeln ('-------------------');
gotoxy(30,11);
textcolor(10);
writeln ('total cost of pizza');
gotoxy(30,12);
textcolor(7);
writeln ('-------------------');
gotoxy(26,10);
writeln;
gotoxy(26,11);
writeln;
gotoxy(5,14);
textcolor(7);
writeln('you have ordered one ', siz ,' ',typename , ' pizza with ', ingred , ' extra ingredients');
gotoxy(22,16);
writeln ('The total cost of this pizza is:');
gotoxy(55,16);
textcolor(10);
writeln ('$', sellingCost:0:2);
gotoxy(28,19);
textbackground(1);
textcolor(7);
writeln ('Press any key to exit...');
while not keypressed do; {Waits for a key to be pressed}
end
Comments: