Write a program that uses the DrawingPanel to produces the following figure. Solution import java.awt.*; public class DrawingEx { public static void main(String [] args) { DrawingPanel panel= new DrawingPanel(500,400); Graphics g = panel.getGraphics(); g.setFont(new Font (\"Monospaced\",Font.Bold,14)); Scanner s=new Scanner(System.in); System.out.println(\"enter number of lines\"); int n= Integer.parseInt(s.readLine()); int m=n; for(int i=0;i<n;i++) { for(int j=0;j<m-1;j++) { System.out.println(\" \"); g.drawLine(m-1,0,m,n) m--; n--; } } } .
Write a program that uses the DrawingPanel to produces the following figure. Solution import java.awt.*; public class DrawingEx { public static void main(String [] args) { DrawingPanel panel= new DrawingPanel(500,400); Graphics g = panel.getGraphics(); g.setFont(new Font (\"Monospaced\",Font.Bold,14)); Scanner s=new Scanner(System.in); System.out.println(\"enter number of lines\"); int n= Integer.parseInt(s.readLine()); int m=n; for(int i=0;i<n;i++) { for(int j=0;j<m-1;j++) { System.out.println(\" \"); g.drawLine(m-1,0,m,n) m--; n--; } } } .