Question: JAVA write a static method that receives a certain amount of time in seconds and then return a string indicating how many minutes and remaining

JAVA
write a static method that receives a certain amount of time in seconds and then return a string indicating how many minutes and remaining seconds are in the given input.

example:
if seconds= 500 then return "500 seconds is (8) minutes and (20) seconds"

DON'T USE ARRAYS . Only use java control structures such ad selection structures, repetition structures and nested loops only.

The test below should pass. Intelli J :

@Test
public void test_1_1_() {
int x = 55820;
String result = Utilities.minutesSeconds(x);
String expect = "55820 seconds is (930) minutes and (20) seconds";
String str = String.format("Test minutesSeconds fail for (%d) Returned ( %s ), but correct is ( %s )", x, result, expect);
assertEquals(str, expect, result):
}

code starts:
public static String minutesSeconds(int seconds) {




Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!