TGC Codebase Backup



Product listings by CrAzKiDd55

6th Oct 2004 16:46
Summary

This program will display 5 products - buying price - selling price - and profit. These can be edited by the admin account in the login prompt but the guest login wil only be able



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` SOURCODE FOR PRODUCT PROGRAM
` made by Crazkidd55 (peter haas)
` 6th october 2004 21:42

dim pro(5,3)


if file exist("values.txt") = 1
load array "values.txt", pro(5,3)
endif

cls

PRINT "LOGIN SCREEN-- IF GUEST PLEASE TYPE anything at login prompt"

input "please enter a password to view and edit the product details>"; password$

` login --- administrator = admin        guest = (anything)

if password$ = "guest" then gosub guestview
if password$ = "admin" then goto start

guestview:

for t=1 to 5

pro(t,3)=pro(t,2)-pro(t,1)

next t
print " "
print "these are 5 products"
print " "
wait 190
print "this is product 1's buying price -->";" ";pro(1,1)
print "this is product 1's selling price -->";" ";pro(1,2)
print "this is product 1's profit -->";" ";pro(1,3)

print " "
wait 100
print "this is product 2's buying price -->";" ";pro(2,1)
print "this is product 2's selling price -->";" ";pro(2,2)
print "this is product 2's profit -->";" ";pro(2,3)

print " "
wait 100
print "this is product 3's buying price -->";" ";pro(3,1)
print "this is product 3's selling price -->";" ";pro(3,2)
print "this is product 3's profit -->";" ";pro(3,3)

print " "
wait 100
print "this is product 4's buying price -->";" ";pro(4,1)
print "this is product 4's selling price -->";" ";pro(4,2)
print "this is product 4's profit -->";" ";pro(4,3)

print " "
wait 100
print "this is product 5's buying price -->";" ";pro(5,1)
print "this is product 5's selling price -->";" ";pro(5,2)
print "this is product 5's profit -->";" ";pro(5,3)
print " "

if pro(1,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 1!!!"
if pro(2,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 2!!!"
if pro(3,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 3!!!"
if pro(4,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 4!!!"
if pro(5,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 5!!!"

print "press any key to exit"

wait key

end

start:

for t=1 to 5

pro(t,3)=pro(t,2)-pro(t,1)

next t
print " "
print "these are 5 products"
print " "
wait 190
print "this is product 1's buying price -->";" ";pro(1,1)
print "this is product 1's selling price -->";" ";pro(1,2)
print "this is product 1's profit -->";" ";pro(1,3)

print " "
wait 100
print "this is product 2's buying price -->";" ";pro(2,1)
print "this is product 2's selling price -->";" ";pro(2,2)
print "this is product 2's profit -->";" ";pro(2,3)

print " "
wait 100
print "this is product 3's buying price -->";" ";pro(3,1)
print "this is product 3's selling price -->";" ";pro(3,2)
print "this is product 3's profit -->";" ";pro(3,3)

print " "
wait 100
print "this is product 4's buying price -->";" ";pro(4,1)
print "this is product 4's selling price -->";" ";pro(4,2)
print "this is product 4's profit -->";" ";pro(4,3)

print " "
wait 100
print "this is product 5's buying price -->";" ";pro(5,1)
print "this is product 5's selling price -->";" ";pro(5,2)
print "this is product 5's profit -->";" ";pro(5,3)
print " "

if pro(1,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 1!!!"
if pro(2,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 2!!!"
if pro(3,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 3!!!"
if pro(4,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 4!!!"
if pro(5,3)<0 then print "YOU ARE MAKING NO PROFIT ON PRODUCT 5!!!"

print " "
wait 100
print " "
print "which product would you like to edit the values of? (numbers 1-5) "
input "  product number>"; choice$
ptbc=VAL(choice$)


Input "Edit buy(1) or sell(2) price?>"; choice$
bsedit=VAL(choice$)

Input "Change to?>"; choice$
tochange=VAL(choice$)

pro(ptbc,bsedit) = tochange

cls

save array "values.txt" , pro(5,3)

goto start


end