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?
Printable View
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.Quote:
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.