Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- public class StarColumn {
- public static void main(String[] args) {
- /**
- * Homework solutions!!
- *
- * For high quality Open Source Java code, beginner to intermediate, search Amazon for:
- *
- * "50 Java Program Source Codes" by Chris Clarke.
- *
- * Also by the same author "50 More Java Source Codes".
- *
- * Available in paperback and e-book.
- */
- int n = 0;
- try {
- // get number using pop-up dialog
- n = Integer.parseInt(
- JOptionPane.showInputDialog( "Enter whole number"));
- }
- catch (NumberFormatException e) {
- System.out.println( "That's not a whole number!");
- } // end try..catch
- System.out.println(); // new line
- for (int i=0; i<n; i++) {
- System.out.print("*");
- } // end for
- System.out.println(); // new line
- } // end main()
- } // end class StarColumn
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement