I need to convert the solution for a user inputed number (for example 4.017) and have it print out the other side as minutes and seconds in the format m minutes, n.nn seconds. How would i do that?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I need to convert the solution for a user inputed number (for example 4.017) and have it print out the other side as minutes and seconds in the format m minutes, n.nn seconds. How would i do that?
By writing some code.How would i do that?
Before you even start that, think about the task. How would *you* rather than a computer perform this arithmetic task?
Once you have the answer to that (or, at least, an answer of which you are confident) you might want to review basic arithmetic operators (don't forget / and %). Then you can convert the method you would use into something the computer can use.
If you have doubts about how you get input from the user, review these topics in your textbook or online tutorials.
-----
If you have difficulty seeing how *anyone* could possibly convert 4.017min into 4 minutes 1.02 seconds - or whatever it is - then post saying what ideas you have had, and any difficulties with them that you have.
Once you have a plan but have some problem translating it into code, post what your plan is and what code you have come up with. If your code won't compile say what the compiler messages are. If it compiles but does something that you consider "wrong" at runtime, say what it does do and what you expect or intend it would do.
-----
Plan (B) might be to sit back and wait for someone to write the code for you. But I am sure you are not expecting anyone to do that.