in java Rewrite the following program to modularise it into separate methods. public class Test { public static void mai

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

in java Rewrite the following program to modularise it into separate methods. public class Test { public static void mai

Post by answerhappygod »

in java
Rewrite the following program to modularise it into separatemethods.
public class Test { public static void main(String[] args) { inti, j; int power; for (i = 1; i < 10; i++) {System.out.println("Here is the multiplication table for " + i);for (j = 1; j < 10; j++) { System.out.println(i + " x " + j + "= " + (i * j)); } System.out.println("Here is a table of powers for" + i); j = 0; power = 1; while (j <= 5) { System.out.println(i+ " to the power of " + j + " is " + power); j++; power = power *i; // multiply once more. }System.out.println("-----------------------"); } } }
In particular: What lines would move into different methods?Why?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply