
-----------------------------------
lashari
Thu Mar 04, 2004 10:49 pm

case construct, a problem
-----------------------------------
in this program when i type "Monday" in the execution window with the capital "M", it  displays the message "mow the lawn" otherwise it would not work, can somebody modify this program so that it will work correctly whether or not the dayof the week is entered with a capital letter.

var day : string
put "Enter the day of the week. " ..
get day
case day of
    label "Monday" :
        put "mow the lawn"
    label "Tuesday" :
        put "do the laundry"
    label "Wednesday" :
        put "shop for groceries"
    label "Thursday" :
        put "vaccuum the carpets"
    label "Friday" :
        put "wash the windows"
    label "Saturday" :
        put "wash the car"
    label "Sunday" :
        put "take a break"
    label :
        put "That wasn't a day that I recognize."
end case

-----------------------------------
zylum
Thu Mar 04, 2004 11:01 pm


-----------------------------------
var day : string
put "Enter the day of the week. " ..
get day
case day of
label "Monday","monday" :
put "mow the lawn"
label "Tuesday","tuesday" :
put "do the laundry"

etc...

just put a common and the alternate spelling/caps

-zylum

-----------------------------------
Hackster
Sat Mar 06, 2004 2:53 pm


-----------------------------------
wow this site has everything, i also need help with case, thanx

-----------------------------------
zylum
Sat Mar 06, 2004 3:21 pm


-----------------------------------
what exactly is your problem?

-----------------------------------
appling
Wed Mar 10, 2004 8:54 pm


-----------------------------------
do u mean this?

var day : string
put "Enter the day of the week. " ..
get day
case day of
    label "Monday", "M", "m" :
        put "mow the lawn"
    label "Tuesday", "T", "t" :
        put "do the laundry"
    label "Wednesday", "W", "w" :
        put "shop for groceries"
    label "Thursday", "Th", "th" :
        put "vaccuum the carpets"
    label "Friday", "F", "f" :
        put "wash the windows"
    label "Saturday", "Sa", "sa" :
        put "wash the car"
    label "Sunday", "S", "s" :
        put "take a break"
    label :
        put "That wasn't a day that I recognize."
end case
