I'm writing pseducode for a Java class. Obviously being pseudo the language shouldn't matter but thought I'd mention it as it would explain any 'bias' I have. BTW, this is my first programming class. I'm revising for my end of semester exam.

Write a pseudo code algorithm which will input a real number. The number represents a length of time, hh.mmss where hh=hours, mm = minutes and ss = seconds. If the input is valid then the algorithm should output the time hours, minutes and seconds.

My attempt:

MAIN

INPUT time

hours = extractHours<-time

minutes=extractMinutes<-time

seconds=extractSeconds<-time

IF (validateTime<-hours, minutes, seconds) THEN

OUTPUT hours, minutes, seconds

END IF

extractHours

hours=(int)time

extractMinutes

tempMinutes=(int)(time*100)

minutes=tempMinutes MOD 100

extractSeconds

tempSeconds=(int)(time*10000)

seconds=tempSeconds MOD 10000

validateTime

isValid=false

IF (0 <= hours <=23) AND (0<= minutes <=59) AND (0<=seconds <=60) THEN

isValid=true

END IF