Author |
Topic |
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 11:26:56
|
here is the code plz tell me wht wrong in it its suppose to show wht you need to the at the time: <%
dim realtime,timea,timeb,timec,timed realtime=time timea=timevalue("07:00") timeb=timevalue("07:45") timec=timevalue("14:30") timed=timevalue("20:00") timee=timevalue("23:00") y="" if realtime<timea then y="get up now to get ready for school!!" else y="" end if
if rimea<timeb then y="go to school" else y="" end if
if timeb<timec then y="make your homework" else y="" end if
if timec<timed then y="get a shower" else y="" end if if timed<timee then y="go to sleep" else y="" end if %> <%=y%>
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 02 March 2002 : 11:39:25
|
Hey Cool ... it's because in each of your if...then...else statements you are essentially resetting y back to "". Also, you use < for each so if the time is 05:00, what do you really want it to say? Get up and go to school or keep sleeping? Do something like this instead:
select case realtime case timea y = "get up now to get ready for school!" case timeb y = "go to school" . . and so on . case else y = "" end select
I'll leave it up to you to figure out how to make sure you include the times in between timea, timeb, timec, etc!!
Edit - I didn't read it very closely the first time...you also have if statements that compare constants that you've set: if timea < timeb ... you're not comparing the realtime to the constants that you've set.
Nikkol
Edited by - Nikkol on 02 March 2002 11:43:47 |
|
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 12:08:32
|
here is the code tell me whts wrong he writting nada: <%
dim realtime,timea,timeb,timec,timed,y realtime=time timea=timevalue("07:00") timeb=timevalue("07:45") timec=timevalue("14:30") timed=timevalue("20:00") timee=timevalue("23:00")
select case realtime
case timea
y = "get up now to get ready for school!"
case timeb
y = "go to school"
case timec
y = "make homework"
case timed
y = "get a shower"
case timee
y = "go to sleep"
end select %> <%=y%>
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 02 March 2002 : 12:17:00
|
It's not writing anything because chances are the realtime isn't equal to any of your constants (timea, timeb, etc.). Try playing around with something like this:
case >= timea and < timeb y = "get up and go to school" case >= timeb and < timec y = "go to school" case >= timec and < timed y = "do your homework"
Scratch that ... it won't work ... it would be easier to use elseif:
if realtime >= timea and realtime < timeb then y = "get up and go to school" else if realtime >= timeb and realtime < timec then y = "do your homework"
and so on...
Nikkol
Edited by - Nikkol on 02 March 2002 12:27:29 |
|
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 12:21:12
|
man! i cant ardenstand plz write me the full code! i worked on my code like hour and i didnt accomplish it plz make it for me! sow i will able to learn out of my mastakes
#######
you are leading me to no where.....
Edited by - coolgil on 02 March 2002 12:24:23 |
|
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 12:32:09
|
quote:
It's not writing anything because chances are the realtime isn't equal to any of your constants (timea, timeb, etc.). Try playing around with something like this:
case >= timea and < timeb y = "get up and go to school" case >= timeb and < timec y = "go to school" case >= timec and < timed y = "do your homework"
Scratch that ... it won't work ... it would be easier to use elseif:
if realtime >= timea and realtime < timeb then y = "get up and go to school" else if realtime >= timeb and realtime < timec then y = "do your homework"
and so on...
Nikkol
Edited by - Nikkol on 02 March 2002 12:27:29
man! i dont really god in asp! plz make it for me! plz it important for my school! i have a work a big work and i need to invate a proudact i told my teacher and she agree! i have no time i need to write the work plz plz plz make it for me!! i will be greatefull
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 02 March 2002 : 12:34:29
|
Sorry for not being clear...trying to save typing ... here:
<% dim realtime,timea,timeb,timec,timed,y realtime=time timea=timevalue("07:00") timeb=timevalue("07:45") timec=timevalue("14:30") timed=timevalue("20:00") timee=timevalue("23:00")
if realtime >= timea and realtime < timeb then y = "get up now to get ready for school!" elseif realtime >= timeb and realtime < timec then y = "go to school" elseif realtime >= timec and realtime < timed then y = "make homework" elseif realtime >= timed and realtime < timee then y = "get a shower" elseif realtime >= timee then y = "go to sleep" else y = "error" end if %>
<%=y%>
Nikkol |
|
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 12:36:25
|
thanks!!
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 02 March 2002 : 12:38:36
|
No problem, BUT being a former teacher, I really shouldn't have done that for you ....next time I'm gonna make you think harder!!
Nikkol |
|
|
CooLGiL
Junior Member
126 Posts |
Posted - 02 March 2002 : 12:39:41
|
ok! thanks
|
|
|
|
Topic |
|