My code has me stumped, My method is right...I think but the output begs to differ. Basically this code is supposed to convert seconds to minutes but the output is somewhat off..here's what I have don so far.

String input = JOptionPane.showInputDialog(null, "Enter a value for seconds (positive whole number): ");



int second = Integer.parseInt(input);

int minutes = second/60; // number of minutes

int seconds = second/60; // number of seconds


JOptionPane.showMessageDialog(null, "Numbber of Seconds is " + second + " is converted to: "
         + minutes + " minutes and " + seconds + " seconds.");

Any pointers / tips would be greatly appreciated :)

for seconds you need the remainder:

int seconds = second%60;
commented: Ah jeez I'm slipping, I knew it was only something small it was missing :) Thank you +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.