Android Open Source - ddgatve-android Multiplication Table






From Project

Back to project page ddgatve-android.

License

The source code is released under:

Apache License

If you think the Android project ddgatve-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package lv.hello;
//from w  w  w . j a va2 s. c o  m
import java.util.Random;

public class MultiplicationTable {

  public static String[] intensities = new String[] { "00", "33", "66", "99", "CC", "FF" };

  public static String randomColor() {
    Random a = new Random();
    return "#" + intensities[a.nextInt(6)] + intensities[a.nextInt(6)]
        + intensities[a.nextInt(6)];
  }

  public static void main(String[] args) {
    int nRows = Integer.parseInt(args[0]);
    int nCols = Integer.parseInt(args[1]);
    String[] colArray = new String[10];
    for (int c = 0; c < 10; c++) {
      colArray[c] = randomColor();
    }
    System.out.println("<table border='1'>\n");
    for (int i = 1; i <= nRows; i++) {
      System.out.println("<tr>");
      for (int j = 1; j <= nCols; j++) {
        int result = i * j;
        int colorNum = result * 10 / (nRows * nCols + 1);
        System.out.println("<td bgcolor='" + colArray[colorNum] + "'>"
            + result + "</td>");
      }
      System.out.println("</tr>\n");
    }
    System.out.println("</table>");

  }
}




Java Source Code List

lv.ddgatve.applets.ColoredCircleApplet.java
lv.ddgatve.applets.MovingCircleApplet.java
lv.ddgatve.applets.PlainCircleApplet.java
lv.ddgatve.applets.SmoothCircleApplet.java
lv.ddgatve.games.game15.Game15Activity.java
lv.ddgatve.games.game15.Game15Frame.java
lv.ddgatve.games.game15.ImageAdapter.java
lv.ddgatve.games.game15.PickFrameDialogFragment.java
lv.ddgatve.games.game15.SummaryActivity.java
lv.ddgatve.games.main.MainActivity.java
lv.ddgatve.games.mtable.DataHolder.java
lv.ddgatve.games.mtable.DisplayMessageActivity.java
lv.ddgatve.games.mtable.MainActivity.java
lv.ddgatve.games.mtable.Questions.java
lv.ddgatve.games.mtable.SummaryActivity.java
lv.ddgatve.math.main.ExampleActivity.java
lv.ddgatve.math.main.MainActivity.java
lv.ddgatve.math.main.PostAsyncTask.java
lv.ddgatve.math.main.RegisterActivity.java
lv.hello.HelloWorld.java
lv.hello.MultiplicationTable.java
lv.kapsitis.myfirstapp.MainActivity.java