// Ayaz Latif // 07/06/2020 // CSE142 // TA: Grace Hopper // Prints a bunch of lines and boxes of asterisks. /* DEVELOPMENT NOTES: ((Note: this is not something you should include in your own programs; this is included here to aid in your understanding and to provide additional context for the program.)) This was our final version of the program, where we used parameters to write very *generic* or *flexible* methods that could produce lines of stars with different lengths depending on what we passed in when calling the method, and similarly could produce boxes of different dimensions when we passed in different width and height. */ public class Stars2 { public static void main(String[] args) { // NOTE; we can use variables to pass values to methods that accept parameters too! int count = 13; line(count); line(7); line(35); box(10, 5); box(5, 6); } // Prints a line of stars with the given length. // int numStars: the number of stars to print on the line public static void line(int numStars) { for (int i = 1; i <= numStars; i++) { System.out.print("*"); } System.out.println(); } // Prints a box of stars with the given width and height. // int width: the width of the printed box // int height: the height of the printed box public static void box(int width, int height) { line(width); // middle for (int line = 1; line <= height - 2; line++) { System.out.print("*"); for (int space = 1; space <= width - 2; space++) { System.out.print(" "); } System.out.println("*"); } line(width); System.out.println(); } }