Please add comments to my code. Thank you import javax.swing.*; /* Outputs the table to a Dialog box */ class multiplication { public static void main(String args[]) { String table = ""; String...



Please add comments to my code. Thank you





import javax.swing.*;


/* Outputs the table to a Dialog box */
class multiplication {
public static void main(String args[]) {
String table = "";
String sizeStr = "Input the size of the multiplication table:";
int size;
sizeStr = JOptionPane.showInputDialog(null, sizeStr);
size = Integer.parseInt(sizeStr);
if (size <= 0)="">
JOptionPane.showMessageDialog(null, "No output for value <=>
} else {
// header
table += " ";
for (int i = 0; i < size;="" i++)="">
table += (i+1);
table += " ";
}
table += "\n";


// table
for (int i = 1; i <= size;="" i++)="">
for (int j = 1; j <= size;="" j++)="">
table += (i * j);
table += " ";
}
table += "\n";
}
JOptionPane.showMessageDialog(null, table);
}
System.exit(0);
}// end main method
}// end class



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here