Hi,
here is my code so far. I was told we need to use two recursive methods. Any help will be very much appreciated. Thank you in advance.
package recursionexercise5; import javax.swing.JOptionPane; public class RecursionExercise5 { public static String saveStars(int n) { String stars, output; output = ""; if (n == 0) { return ""; } else { stars = "*"; stars = stars + saveStars(n - 1); stars = stars + line(stars, n-1); System.out.println(stars); return stars; } } public static String line(String s, int num) { String st, output; if (num == 0) { return ""; } else { return line(s += "\n", num - 1); } } public static void main(String[] args) { String sNum; int num, tStars; String stars; sNum = JOptionPane.showInputDialog("Enter the height"); num = Integer.parseInt(sNum); stars = saveStars(num); JOptionPane.showMessageDialog(null, stars); } }