I remember having a similar assignment for pascal. Can't believe I still have the code.
Program Jimmys_Pizza_Shack;
{Dustin Z.,11-2-99, A menu program for ordering pizza}
uses crt, graph;
procedure select_crust (var Crust_type : string);
var ch: char;
begin
clearviewport;
setcolor(1);
outtextXY(240,200,'Select crust type:');
setcolor(2);
outtextXY(241,201,'Select crust type:');
setcolor(1);
outtextXY(240,220,'1) Thin crust');
outtextXY(240,235,'2) Thick crust');
ch:=readkey;
case ch of
'1': Crust_type:= 'thin';
'2': Crust_type:= 'thick';
end;
end;
procedure select_size(var Pizza_Size: string);
var ch: char;
begin
clearviewport;
setcolor(1);
outtextXY(240,200,'Select pizza size:');
setcolor(2);
outtextXY(241,201,'Select pizza size:');
setcolor(1);
outtextXY(240,220,'1) Small');
outtextXY(240,235,'2) Medium');
outtextXY(240,250,'3) Large');
ch:=readkey;
case ch of
'1': pizza_size:='small';
'2': pizza_size:='medium';
'3': pizza_size:='large';
end;
end;
procedure select_toppings(var Pizza_toppings: integer);
var ch: char;
begin
clearviewport;
setcolor(1);
outtextXY(240,200,'Select pizza toppings:');
setcolor(2);
outtextXY(241,201,'Select pizza toppings:');
setcolor(1);
outtextXY(240,220,'1) Pepperoni');
outtextXY(240,235,'2) Peppers');
outtextXY(240,250,'3) Mushrooms');
outtextXY(240,265,'4) Lit''l fishys');
outtextXY(240,280,'5) No toppings');
ch:=readkey;
case ch of
'1': Pizza_toppings := 1;
'2': Pizza_toppings := 2;
'3': Pizza_toppings := 3;
'4': Pizza_toppings := 4;
'5': Pizza_toppings := 5;
end;
end;
{-------------------------------------------------------------}
procedure plain_pizza;
begin
setcolor(6);
circle(550,75,45);
setfillstyle(solidfill, 6);
floodfill(550,75,6);
setcolor(14);
circle(550,75,40);
end;
procedure with_pepperoni;
begin
setcolor(4);
setfillstyle(solidfill, 4);
circle(530,93,5);
floodfill(530,93,4);
circle(560,79,5);
floodfill(560,79,4);
circle(532,70,5);
floodfill(532,70,4);
circle(580,85,5);
floodfill(580,85,4);
circle(571,95,5);
floodfill(571,95,4);
circle(528,55,5);
floodfill(528,55,4);
circle(552,96,5);
floodfill(552,96,4);
circle(565,57,5);
floodfill(565,57,4);
circle(545,64,5);
floodfill(545,64,4);
end;
procedure with_peppers;
begin
setcolor(2);
arc(534,87,90,245,4);
arc(564,95,90,245,4);
arc(590,76,90,245,4);
arc(579,67,90,245,4);
arc(581,87,90,245,4);
arc(527,69,90,245,4);
arc(534,57,90,245,4);
arc(554,50,90,245,4);
arc(549,80,90,245,4);
arc(554,105,90,245,4);
end;
procedure with_mushrooms;
begin
setcolor(7);
setfillstyle(solidfill, 7);
PieSlice(531, 85, 0, 180, 3);
bar(530,85,532,88);
PieSlice(556, 91, 0, 180, 3);
bar(555,91,557,94);
PieSlice(587, 72, 0, 180, 3);
bar(586,72,588,75);
PieSlice(547, 75, 0, 180, 3);
bar(546,75,548,78);
PieSlice(542, 52, 0, 180, 3);
bar(541,52,543,55);
end;
procedure with_fish;
begin
setcolor(12);
setfillstyle(solidfill, 12);
Ellipse(530,100,0,360,4,2);
floodfill(530,100,12);
putpixel(528,99,0);
Ellipse(545,85,0,360,4,2);
floodfill(545,85,12);
putpixel(543,84,0);
Ellipse(520,78,0,360,4,2);
floodfill(520,78,12);
putpixel(518,77,0);
Ellipse(570,73,0,360,4,2);
floodfill(570,73,12);
putpixel(568,72,0);
Ellipse(565,103,0,360,4,2);
floodfill(565,103,12);
putpixel(563,102,0);
Ellipse(540,60,0,360,4,2);
floodfill(540,60,12);
putpixel(538,59,0);
Ellipse(562,62,0,360,4,2);
floodfill(562,62,12);
putpixel(560,61,0);
end;
{--------------------Main Program-------------------------------------}
var ch:char;
crust_type,pizza_size, s, s2 : string;
crust_price, topping_size, toppings_price, size_price, total : real;
number_toppings, pizza_toppings : integer;
pepperoni, peppers, mushrooms, fish : integer;
top1, top2, top3, top4, a, b : integer;
device, mode : integer;
const
thin = 1.0;
thick = 1.2;
small_price = 4.00;
medium_price = 6.00;
large_price = 8.00;
top_S = 0.50;
top_M = 0.75;
top_L = 1.00;
BEGIN
detectgraph (device, mode);
initgraph(device, mode,'c:\tp\bgi');
a:=0; b:=0;
top1:=0; top2:=0; top3:=0; top4:=0;
pepperoni := 0;
peppers := 0;
mushrooms := 0;
fish := 0;
Number_Toppings := 0;
Crust_Price:= 0.0;
Size_Price:= 0.0;
Toppings_Price:= 0;
repeat
Pizza_toppings:= 0;
clearviewport;
plain_pizza;
if top1 = 1 then with_pepperoni;
if top2 = 1 then with_peppers;
if top3 = 1 then with_mushrooms;
if top4 = 1 then with_fish;
setcolor(1);
outtextXY(240,200,'Main Menu:');
setcolor(2);
outtextXY(241,201,'Main Menu:');
setcolor(1);
outtextXY(240,220,'1) Crust type');
outtextXY(240,235,'2) Size of pizza');
outtextXY(240,250,'3) Toppings on the pizza');
outtextXY(240,265,'4) Done');
settextstyle(triplexfont,horizdir,5);
outtextxy(1,1,'Jimmy''s Pizza Shack');
setcolor(2);
outtextxy(3,3,'Jimmy''s Pizza Shack');
setcolor(1);
settextstyle(defaultfont,horizdir,1);
ch:=readkey;
case ch of
'1' : begin
select_crust(Crust_type);
a:=1;
end;
'2' : begin
select_size(Pizza_Size);
b:=1;
end;
'3' : select_toppings(Pizza_toppings);
'4' :
end;
if Crust_Type = 'thin' then Crust_price := thin;
if Crust_Type = 'thick' then Crust_price := thick;
if (Pizza_toppings = 1) and (pepperoni = 0) then
begin
Number_Toppings := Number_Toppings + 1;
top1:= 1;
end;
if (Pizza_toppings = 2) and (peppers= 0) then
begin
Number_Toppings := Number_Toppings + 1;
top2:= 1;
end;
if (Pizza_toppings = 3) and (mushrooms = 0) then
begin
Number_Toppings := Number_Toppings + 1;
top3:= 1;
end;
if (Pizza_toppings = 4) and (fish = 0) then
begin
Number_Toppings := Number_Toppings + 1;
top4:= 1;
end;
if Pizza_toppings = 5 then
begin
Number_Toppings := 0;
top1:= 0;top2:= 0;top3:= 0;top4:= 0;
end;
if pizza_size ='small' then
begin
size_price:= small_price;
topping_size:= top_s;
end;
if pizza_size ='medium' then
begin
size_price:= medium_price;
topping_size:= top_m;
end;
if pizza_size ='large' then
begin
size_price:= large_price;
topping_size:= top_l;
end;
until (ch = '4') and (a = 1) and (b = 1);
toppings_price:= number_toppings * topping_size;
total:= (Crust_price * size_price) + toppings_price;
str(number_toppings:1, s);
str(total:1:2, s2);
setcolor(4);
moveto(80, 320);
outtext('You ordered a ');
outtext(pizza_size);
outtext(', ');
outtext(s);
outtext(' topping pizza with ');
outtext(crust_type);
outtext(' crust');
outtext(' for $');
outtext(s2);
readln;
END.
