Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ----Time---
Index -> Programming, Java -> Java Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xX_MayDay_Xx




PostPosted: Mon Feb 13, 2006 9:00 am   Post subject: ----Time---

yes and hello everyone...i am new to progamming and have come across something that bothers the hell out of me.

im trying to make a game were the user input's a time, in hours....(example-38.50=38 hours, and 30 mins)
but i cant get the code right to change the 38.50 into the time....i know the hours are given, and i don't really like math all that much so any help would be greatly aprrciated.
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Mon Feb 13, 2006 10:43 am   Post subject: (No subject)

sounds pretty much do-able to me.. post up the code you so far, and I'll see if i could be of any help Wink
MysticVegeta




PostPosted: Mon Feb 13, 2006 2:46 pm   Post subject: (No subject)

1) Convert double into string
2) Check if the index of "." in the string >= 0, if it is split it else let the string stay the same.
3) Convert the first and second element of the splitArray into ints, multiply the second one by 60.

Note: Step 3 is if String.indexOf(".") >= 0;
otherwise just convert the string into int Smile
wtd




PostPosted: Mon Feb 13, 2006 2:47 pm   Post subject: (No subject)

Convert the string to a float, then grab the decimal part and multiply by 60.
xX_MayDay_Xx




PostPosted: Tue Feb 14, 2006 8:42 am   Post subject: (No subject)

public class Time
{
public static void main (String[]args)
{
double num, hours, min, sec;
System.out.println("Please enter a length of time");
System.out.println("Example '36.50= 36hours and 30minutes'");
num=In.getDouble();
}
}


--------------------------------------------------------------------------------------This is all i have, so far. Any help with it would be geatly apreciated....also, i have to write a progam that would take a letter, and then but the postion of the alphabit. (Example, A=1. B=2)
Andy




PostPosted: Tue Feb 14, 2006 8:45 am   Post subject: (No subject)

well, all you have there is inputting the number, why dont you read what the nice people up there posted, and try to play around with it a bit before asking for help?
xX_MayDay_Xx




PostPosted: Tue Feb 14, 2006 4:33 pm   Post subject: (No subject)

arrg....that envoles math.....i hate math,...with a passion...(Yes i know the irony, a computer coder who hates math)

and i have tried other things, but for some reason i cant get them to work properlly...i don't have them any more becuase i recently formatted my computer.
[Gandalf]




PostPosted: Tue Feb 14, 2006 4:48 pm   Post subject: (No subject)

You don't know how to multiply?... wtd's solution shouldn't be a problem at all.
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Tue Feb 14, 2006 6:16 pm   Post subject: (No subject)

xX_MayDay_Xx wrote:
arrg....that envoles math.....i hate math,...with a passion...(Yes i know the irony, a computer coder who hates math)

and i have tried other things, but for some reason i cant get them to work properlly...i don't have them any more becuase i recently formatted my computer.


so basicly, let me get this straight... you're too lazy to do your own homework, fine, you ask for help, then you're too lazy to read the help people give you and wants one of us to do it for you? wth do you think u are
MysticVegeta




PostPosted: Tue Feb 14, 2006 7:30 pm   Post subject: (No subject)

Wth? Converting decimal into minutes isnt that hard.. Shocked
Andy




PostPosted: Tue Feb 14, 2006 8:56 pm   Post subject: (No subject)

its not hard.. he's just too lazy to think
xX_MayDay_Xx




PostPosted: Wed Feb 15, 2006 8:08 am   Post subject: (No subject)

yes....i am lazy, and i like i said....i am very new to JAVA programming, turing i have no problem with....i don't even know what a float is.....don't you see my rank on this fourm...i belive it states "newbie" , so please stop giving me a hard time....i know im lazy, i know im a noob, but i learn by seeing, not figuring it all out by myself. and besides im a hardware guy....i don't like dealing with software.............
rizzix




PostPosted: Wed Feb 15, 2006 12:36 pm   Post subject: (No subject)

That IS not his point! LOOK at the help your received! Don't expect us to give you the answer.
Andy




PostPosted: Wed Feb 15, 2006 1:49 pm   Post subject: (No subject)

what makes you think that we're here to do your homework for you? the point of the forum is to provide people help with specific programming roadblocks, and help those who are helping you to get better through explaining. I dont see how doing your homework serves either purpose.

But, since you're an hardware guy, i guess we could get this arranged... tell me the number of different packets in the ATI's R600 PM4 stream, and i'll do this for you.
Andy




PostPosted: Wed Feb 15, 2006 1:52 pm   Post subject: (No subject)

But, just so i dont sound like a total jerk.. a float is basicly a real number in turing, its not really, but since ur a hardware guy, you should know what flops is.

oh, and if you're master turing, post your turing solution to this problem, and we could help you translate that into java.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 40 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: