Avatar of sendhelp

asked on 

GUI to print stars rectangles with user input

I am writing an interactive Java GUI program that requests two numbers from the user. The first number is the row dimension and the second number is the column dimension. Print to the user a rectangle of stars based on the input. The program must, print the rectangle of stars, error check for bad input: alphabetic characters or negative numbers. Do not end the program but remind the user of the proper input, and allow the user to use the program until the user decides to terminate the program.

I am stuck, this is as far as I can get, what else do I need.

import javax.swing.JOptionPane;
public class RectangleOfStars
      public static void main(String[] args)
            double rows, columns;
            String rowsStr, columnsStr, outputStr;
            rowsStr = JOptionPane.showInputDialog("Enter the number of rows: ");
            rows = Double.parseDouble(rowsStr);
            columnsStr = JOptionPane.showInputDialog("Enter the of columns: ");
            columns = Double.parseDouble(columnsStr);
            stars =
            outputStr = stars ;
            JOptionPane.showMessageDialog(null, outputStr, "Rectangle of Stars", JOptionPane.INFORMATION_MESSAGE);

Avatar of undefined
Last Comment

8/22/2022 - Mon