locked
menu, price output RRS feed

  • Question

  • TextWindow.Write("weekday?: " )
    weekday=textwindow.Read()
    menu["月"][1]="a"
    menu["火"][1]="b"
    menu["水"][1]="c"
    menu["木"][1]="d"
    menu["金"][1]="e"
    menu["月"][2]=3000
    menu["火"][2]=4000
    menu["水"][2]=5000
    menu["木"][2]=6000
    menu["金"][2]=7000

    TextWindow.WriteLine(weekday+"menu is"+menu[weekday][1]+", price is"+menu[weekday][2])
    TextWindow.WriteLine(" ")

    TextWindow.Write("menu? ")
    menu=textwindow.Read()
    weekday=array.GetAllIndices(menu)
    For i= 1 To Array.GetItemCount(weekday)
      If menu[weekday[i]][1]= menu Then
     TextWindow.WriteLine("weekday is"+weekday[i]+ ", price is"+menu[weekday[i]][2])
      EndIf
    EndFor

    If I input the menu, the Output is the weekday and price,

     

    but I can't solve the second part of outputting the weekday and price.

     

    What's the problem of that? :)

     

    LOVE DO

    Monday, June 16, 2014 1:46 AM

Answers

  • Or below.

    TextWindow.Write("weekday?: " )
    weekday=textwindow.Read()
    menu["Mon"]="1=a;2=3000"
    menu["Tue"]="1=b;2=4000"
    menu["Wed"]="1=c;2=5000"
    menu["Thu"]="1=d;2=6000"
    menu["Fri"]="1=e;2=7000"

    TextWindow.WriteLine(weekday+" menu is "+menu[weekday][1]+" , price is "+menu[weekday][2])
    TextWindow.WriteLine(" ")

    TextWindow.Write("Sub menu ? ex.. b ")
    Submenu=textwindow.Read()
    Weekdays="1=Mon;2=Tue;3=Wed;4=Thu;5=Fri"
    For i= 1 To Array.GetItemCount(Weekdays)
      If menu[weekdays[i]][1]=submenu Then 
        TextWindow.WriteLine("weekday is "+i+" : "+weekdays[i]+ " , price is "+menu[Weekdays[i]][2])
      EndIf
    EndFor

    My PC denied 金so, i changed Kanji to English.

    Monday, June 16, 2014 4:08 AM
    Answerer

All replies

  • is it this?

    menu["月"][1]="a"
    menu["火"][1]="b"
    menu["水"][1]="c"
    menu["木"][1]="d"
    menu["金"][1]="e"
    menu["月"][2]=3000
    menu["火"][2]=4000
    menu["水"][2]=5000
    menu["木"][2]=6000
    menu["金"][2]=7000
    TextWindow.Write("weekday?: " )
    weekday=textwindow.Read()
    TextWindow.WriteLine(menu[weekday][1])
    TextWindow.WriteLine(menu[weekday][2])


    Best Regards Martin

    Monday, June 16, 2014 3:51 AM
  • Or below.

    TextWindow.Write("weekday?: " )
    weekday=textwindow.Read()
    menu["Mon"]="1=a;2=3000"
    menu["Tue"]="1=b;2=4000"
    menu["Wed"]="1=c;2=5000"
    menu["Thu"]="1=d;2=6000"
    menu["Fri"]="1=e;2=7000"

    TextWindow.WriteLine(weekday+" menu is "+menu[weekday][1]+" , price is "+menu[weekday][2])
    TextWindow.WriteLine(" ")

    TextWindow.Write("Sub menu ? ex.. b ")
    Submenu=textwindow.Read()
    Weekdays="1=Mon;2=Tue;3=Wed;4=Thu;5=Fri"
    For i= 1 To Array.GetItemCount(Weekdays)
      If menu[weekdays[i]][1]=submenu Then 
        TextWindow.WriteLine("weekday is "+i+" : "+weekdays[i]+ " , price is "+menu[Weekdays[i]][2])
      EndIf
    EndFor

    My PC denied 金so, i changed Kanji to English.

    Monday, June 16, 2014 4:08 AM
    Answerer