Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you help me with this. Create a method called mathQuestion , There should be

ID: 3781095 • Letter: C

Question

Can you help me with this.

Create a method called mathQuestion, There should be no return value, and it should take no parameters. Implement a loop that will run exactly 5 times, start with 1, and increment by 1 each loop. Inside the loop you will print the current iteration of the loop, the 2 divided by the current iteration, the current iteration modulo 5.Create a method called mathQuestion, There should be no return value, and it should take no parameters. Implement a loop that will run exactly 5 times, start with 1, and increment by 1 each loop. Inside the loop you will print the current iteration of the loop, the 2 divided by the current iteration, the current iteration modulo 5.

The book is: Objects First with Java 6th ed

Explanation / Answer

void mathQuestion()
{
   int i;
for (i = 1; i <= 5; i++)
{
System.out.println("Current iteration : " + i);
  
double div = 2.0/i;
System.out.println("Two divided by current iteration: " + div);
  
int modulo = i % 5;
System.out.println("Current iteration moduleo 5: " + modulo);
  
}
}