- /// Samhitha Balaji
- /// 09/17/21
- /// Assignment 3. Draw a Pretty Picture
- //This program will use ASCII characters to create an abstract design
- public class assign03 {
- // Sets variables for image - size can be varied
- public static int SIZE = 10;
- public static int DOUBLE = 2;
- //Method creates the point/triangle of image
- public static void top() {
- for (int i = 0; i <= SIZE; i++) { //Loop to match size declared by variable
- for (int j = 1; j <= (-1 * i + SIZE); j++) {
- System.out.print(" ");
- }
- System.out.print(" _/");
- for (int k = 1; k <= (i * DOUBLE); k++) {
- System.out.print(" ");
- }
- System.out.print("\\_");
- System.out.println("");
- }
- }
- //Method creates upward facing line of image
- public static void lineUp() {
- System.out.println();
- for (int m = 1; m <= DOUBLE; m++) {
- for (int x = 1; x <= (SIZE); x++) {
- System.out.print("/");
- System.out.print("\\");
- }
- System.out.print(" ");
- }
- System.out.println("");
- }
- //Method creates straight lines of image
- public static void lineReg() {
- for (int k = 1; k <= DOUBLE; k++) { //Loop that prints lines twice
- for (int y = 1; y <= DOUBLE; y++) { //Loop that repeats line with space
- for (int x = 1; x <= (SIZE*DOUBLE); x++) { //Determines line size based on SIZE
- System.out.print("_");
- }
- System.out.print(" ");
- }
- System.out.println();
- }
- }
- //Method creates downward facing line of image
- public static void lineDown() {
- System.out.println();
- for (int m = 1; m <= DOUBLE; m++) {
- for (int x = 1; x <= (SIZE); x++) {
- System.out.print("\\");
- System.out.print("/");
- }
- System.out.print(" ");
- }
- System.out.println();
- }
- public static void main(String[] args) {
- top();
- lineUp();
- lineReg();
- lineDown();
- }
- }
[text] Assignment 3
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new:
File Description
- Assignment 3
- Paste Code
- 18 Sep-2021
- 1.85 Kb
You can Share it: