So I have an infile that I have to read a double but it is shown in time format.
so for example, it says 3:00 but I need it to be read as a double. How would I scan it as a double?
You may need to read it as time or string and convert it to double. What should 3:00 be interpretted as in double form?
It's for an assignment I have to do, I have to scan it as a double. I was thinking of reading it as a string then converting it as a double. I would have to replace the ":" to a "." though correct?
Are you saying 3:00 = 3.00? I would think 3:00 = 0.125.
I got lost right their. Could you explain why 3:00 = .125 ? I would say either 3:00 = 180min * 1 hr / 60min = 3.00 hr. or 3:00 = 18 (15th or third hour in the day) and then would proceed with 15:00 = 900 min * 1 hr / 60min = 15.00 hr.
You could do something like this.
Code:String time = "3:00"; time = time.replace(":","."); double timeDouble = Double.parseDouble(time);
3:00 am = 3/24 = 1/8 = 0.125.
Oh, that makes sense.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks