Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need some help on project (alomst finished some snags)
#1
got a project, basically i have to make a grocery register thing with 18 products, codes and prices, have all of that but part of the proj. is to have a "help screen" that will display all the products, product codes and prices, well i have that help screen but i have no way of getting back to the main screen i.e. where i should input stuff, any help would be appreciated
Code:
CLS

DIM price!(18)
DIM code$(18)
DIM prod$(18)
DIM x$(18)

prod$(1) = "Apple"
prod$(2) = "Banana"
prod$(3) = "Pear"
prod$(4) = "Orange"
prod$(5) = "Bread"
prod$(6) = "Jam"
prod$(7) = "Peanut Butter"
prod$(8) = "Butter"
prod$(9) = "Milk (1L)"
prod$(10) = "Milk (2L)"
prod$(11) = "Orange Juice"
prod$(12) = "Apple Juice"
prod$(13) = "Ice Cream"
prod$(14) = "Cookies"
prod$(15) = "Beans"
prod$(16) = "Chips"
prod$(17) = "Chocolate Bar"
prod$(18) = "Soda"

code$(1) = "001"
code$(2) = "002"
code$(3) = "003"
code$(4) = "004"
code$(5) = "005"
code$(6) = "006"
code$(7) = "007"
code$(8) = "008"
code$(9) = "009"
code$(10) = "010"
code$(11) = "011"
code$(12) = "012"
code$(13) = "013"
code$(14) = "014"
code$(15) = "015"
code$(16) = "016"
code$(17) = "017"
code$(18) = "018"

price!(1) = .28
price!(2) = .15
price!(3) = .45
price!(4) = .35
price!(5) = 1.15
price!(6) = 2.45
price!(7) = 3.25
price!(8) = 4!
price!(9) = 1.89
price!(10) = 3.59
price!(11) = 3.25
price!(12) = 1.99
price!(13) = 4.99
price!(14) = 5.25
price!(15) = 1.12
price!(16) = .59
price!(17) = 1.05
price!(18) = 1.12


CLS

LOCATE 3, 19
COLOR 4
PRINT "Code"
LOCATE 3, 30
PRINT "Product"
LOCATE 3, 50
COLOR 2
PRINT "Price"

k = 0
s! = 0
DO

LOCATE 4 + k, 19
INPUT "", x$
FOR i = 1 TO 18
  
  g! = s! * .08
  p! = s! * .07
  
  IF x$ = code$(i) THEN
    LOCATE 4 + k, 19
    PRINT code$(i)
  
    LOCATE 4 + k, 30
    PRINT prod$(i)
  
    LOCATE 4 + k, 50
    PRINT USING "##.##"; price!(i)
    s! = s! + price!(i)
  
  
    LOCATE 20, 45
    PRINT "SUBTOTAL:"
  
    LOCATE 20, 55
    PRINT USING "$##.##"; s!

    ELSEIF x$ = "" THEN
    COLOR 6
    LOCATE 21, 55
    PRINT USING "$##.##"; p!
    LOCATE 21, 50
    PRINT "PST:"
  
    COLOR 6
    LOCATE 22, 55
    PRINT USING "$##.##"; g!
    LOCATE 22, 50
    PRINT "GST:"
  
    LOCATE 23, 55
    PRINT USING "$##.##"; s! + p! + g!
    LOCATE 23, 48
    PRINT "TOTAL:"
                               'HELP PAGE
    ELSEIF x$ = "999" THEN
      CLS
      FOR i = 1 TO 18
      LOCATE 3, 19
      COLOR 4
      PRINT "Code"
      LOCATE 3, 30
      PRINT "Product"
      LOCATE 3, 50
      COLOR 2
      PRINT "Price"
      LOCATE 4 + i, 20
      PRINT code$(i)
      LOCATE 4 + i, 30
      PRINT prod$(i)
      LOCATE 4 + i, 50
      PRINT USING "$##.##"; price!(i)
      NEXT i
  
   END IF
NEXT i
k = k + 1
LOOP UNTIL x$ = "000
Reply
#2
Maybe telling us exactly what is happeneing when you run the code. I haven't used Qb for a while but correct me if I'm wrong, but wouldn't:

Code:
dim code$(18)

give a 0 to 17 indexed array? You may have to change that, then on line 82:

Code:
INPUT "", x$

you're input variable is already used by an array, you'd have to change that to another variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)