%%%%%%%%%%%
% CASHIER %
%%%%%%%%%%%%%%%
% BLING-BLING %
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Variable Declaration
colour (0)
colourback (7)
cls
var slidingTitle : int := 0
var titleFont, shopFont : int
titleFont := Font.New ("serif:80")
shopFont := Font.New ("serif:20")
var x, y, button : int
var increase : int := 5
var foodItems : array 1 .. 5 of string
foodItems (1) := "Cheese Blintz"
foodItems (2) := "Corn Muffin"
foodItems (3) := "Cactus Juice"
foodItems (4) := "Moldy Cheese"
foodItems (5) := "Liver Shnitzel"
var foodPrices : array 1 .. 5 of real
foodPrices (1) := 4.59
foodPrices (2) := 5.49
foodPrices (3) := 9.99
foodPrices (4) := 15.01
foodPrices (5) := 20.33
var listOrder : int := 3
var answer : int
var addItems, addPrices : int
var foodNames : string
var itemSelect : int
var priceSelect : real
var recallName : int
var newPrice : real
colour (0)
colourback (7)
%Intro Procedure
%note: View.Update was the best way to avoid streaking and flickering
procedure intro
View.Set ("offscreenonly")
for title : 1 .. 500
cls
Font.Draw (" Jane & Finch", title - 500, 300, titleFont, brightred)
Font.Draw (" Super Store ", 500 - title, 100, titleFont, brightred)
View.Update
end for
View.Set ("nooffscreenonly") %end of animations, output will be drawn on screen
%%%Entrance Point%%%
Draw.FillBox (240, 200, 422, 230, 0)
loop
mousewhere (x, y, button)
if button = 0 and whatdotcolour (x, y) = white then %button is not pressed and the mouse is over the entrance point
locate (12, 32)
put "[ALEX YOUNG OWNS YOU]" ..
delay (100)
elsif button = 0 and whatdotcolour (x, y) not= white then %button is not pressed and the mouse is not over the entrance point
locate (12, 32)
put "[CLICK HERE TO ENTER]" ..
delay (100)
elsif button = 1 and whatdotcolour (x, y) = white then %entering the store if button is pressed over the entrance point
delay (1000)
cls
exit
end if
end loop
end intro
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Innitial Output
procedure innitialShop
drawline (1, maxy - 25, 400, maxy - 25, 0) %horizontal line for item/price list
drawline (200, 0, 200, maxy, 0) %vertical line for item/price list
Font.Draw ("Item", 70, maxy - 20, shopFont, brightred)
Font.Draw ("Price ($)", 260, maxy - 20, shopFont, brightred)
for i : 1 .. 5
locate (listOrder, 1) %location of each consecutive item
put foodItems (i) .. %.. so that the items do not cut off the vertical line for the item/price list
listOrder += 1 %each consecutive item is located 1 line below the previous
locate (listOrder - 1, 30)
put foodPrices (i) : 0 : 2 %2 values after the decimal point
end for
end innitialShop
View.Set ("nooffscreenonly")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Changing Around The Shop
procedure changeShop
Font.Draw ("Once In A Life Time Choice", maxx - 320, 110, shopFont, brightred)
drawbox (maxx - 330, 10, maxx - 5, 100, 0)
locate (20, 53)
put "Do you wish to:" ..
locate (21, 40)
put "1. Add an item / corresponding price?" ..
locate (22, 40)
put "2. Change a price?" ..
locate (23, 40)
put "3. Make a Purchase?" ..
locate (24, 40)
put "[Enter number of choice] " ..
get answer
loop
%Input For New Items / Corresponding Prices (OPTION #1)
if answer = 1 %add an item / corresponding price option was chosen
then
cls
Font.Draw ("Manager For A Moment",0,maxy-20,shopFont,brightred)
locate (3,1)
put "How many items would you like to add? " ..
get addItems
addPrices := addItems
var addFoodItems : array 1 .. addItems of string
for a : 1 .. addItems
put "Item # ", a, " to be added shall be named? " ..
get addFoodItems (a) : *
end for
%Input for New Prices
var addFoodPrices : array 1 .. addPrices of real
for b : 1 .. addPrices
put "How much should item #", b, " cost? $" ..
get addFoodPrices (b)
end for
cls %clears the input section
%Output For New Items
listOrder := 3 %miniature variable reset
innitialShop %procedure displaying the original items
for a : 1 .. addItems
locate (listOrder, 1) %situated beneath the preset items in the items column
put addFoodItems (a) ..
listOrder += 1
end for
%Output for New Prices
listOrder := 3 %miniature variable reset
innitialShop %procedure displaying the original items
for b : 1 .. addPrices
locate (listOrder, 30) %situated beneath the preset prices in the price column
put addFoodPrices (b) : 0 : 2 .. %2 values after the decimal point
listOrder += 1
end for
end if
%Changing The Price Of A Specific Item
if answer = 2 then
Font.Draw("Price Alteration",maxx - 210,maxy-90,shopFont,brightred)
drawbox (400, maxy - 200, maxx - 10, maxy - 100, 0)
locate (8, 52)
put "Select an item #: " ..
get recallName %name location within the array
locate (9, 52)
put foodItems (recallName), " new cost:".. %displays the item numbers name
locate (10, 52)
put "$"..
get newPrice %user inputs new price
foodPrices (recallName) := newPrice %insert new price into the array
cls
end if
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
exit
end loop
listOrder := 3 %miniature variable reset
innitialShop
changeShop
end changeShop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%First Time Running The Program
intro
innitialShop
changeShop
|