Question

Need the answer in Java1.17 LAB*: Program: ASCII art This zyLab activity is the traditional programming assignment, typically requiring a few hours

1.17 LAB*: Program: ASCII art

This zyLab activity is the traditional programming assignment, typically requiring a few hours over a week. The previous sections provide warm up exercises intended to help a student prepare for this programming assignment.

(1) Output this tree. (2 pts)

   *
  ***
 *****
*******
  ***


(2) Below the tree (with two blank lines), output this cat. (3 pts)

/\   /\
  o o
 =   =
  ---

Hint: A backslash \ in a string acts as an escape character, such as with a newline \n. So, to print an actual backslash, escape that backslash by prepending another backslash. Ex: The following prints a single backslash: System.out.println("\\");

LAB

ACTIVITY

1.17.1: LAB*: Program: ASCII art

public class AsciiArt {
public static void main(String[] args) {

// Draw tree
System.out.println(" *");
System.out.println(" ***");
/* Type your code here */
}
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class AsciiArt {
    public static void main(String[] args) {
        System.out.println("" +
                "   *\n" +
                "  ***\n" +
                " *****\n" +
                "*******\n" +
                "  ***");

        System.out.println("" +
                "/\\   /\\\n" +
                "  o o\n" +
                " =   =\n" +
                "  ---");
    }
}

- - - V V 平平平 ¥¥¥¥¥¥¥ 平平平平平 羊羊羊

Add a comment
Answer #2

public class AsciiArt {

    public static void main(String[] args) {



      System.out.println("   *");

      System.out.println("  ***");

      System.out.println(" *****");

      System.out.println("*******");

      System.out.println("  ***\n\n");

      

      

      System.out.println("/\\   /\\");

      System.out.println("  o o");

      System.out.println(" =   =");

      System.out.println("  ---");



Add a comment
Know the answer?
Add Answer to:
Need the answer in Java 1.17 LAB*: Program: ASCII art This zyLab activity is the traditional...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program: ASCII art

    1.16 LAB*: Program: ASCII artThis zyLab activity is the traditional programming assignment, typically requiring a few hours over a week. The previous sections provide warm up exercises intended to help a student prepare for this programming assignment.(1) Output this tree. (2 pts)   *   ***  ***** *******   ***(2) Below the tree (with two blank lines), output this cat. (3 pts)/\   /\   o o  =   =   ---Hint: A backslash \ in a string acts as an escape character, such as with a newline \n. So, to print an actual backslash,...

  • 1.20 LAB: Warm up: Basic output with variables This zyLab activity prepares a student for a...

    1.20 LAB: Warm up: Basic output with variables This zyLab activity prepares a student for a full programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment, and are well-suited for an in-person scheduled lab meeting or as self-practice. A variable like userNum can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 pts) Output the input squared and cubed. Hint: Compute squared as userNum...

  • 5.13 Program: Drawing a half arrow (Python 3) This zyLab activity is the traditional programming assignment,...

    5.13 Program: Drawing a half arrow (Python 3) This zyLab activity is the traditional programming assignment, typically requiring a few hours over a week. The previous section provides warm up exercises intended to help a student prepare for this programming assignment. This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. (1) Modify the given program to...

  • 1.8 zyLab training: Basics (Java) While the zyLab platform can be used without training, a bit...

    1.8 zyLab training: Basics (Java) While the zyLab platform can be used without training, a bit of training may help some students avoid common issues. The assignment is to get an integer from input, and output that integer squared, ending with newline. (Note: This assignment is configured to have students programming directly in the zyBook. Instructors may instead require students to upload a file). Below is a program that's been nearly completed for you. Click "Run program". The output is...

  • Warm up: Basic output with variables

    1.14 LAB: Warm up: Basic output with variablesThis zyLab activity prepares a student for a full programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment, and are well-suited for an in-person scheduled lab meeting or as self-practice.A variable like userNum can store a value like an integer. Extend the given program as indicated.Output the user's input. (2 pts)Output the input squared and cubed. Hint: Compute squared as userNum * userNum. (2 pts)Get a second user...

  • Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for...

    Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for sample program: 3.5 import java.util.Scanner; public class HourToMinConv {    public static void outputMinutesAsHours(double origMinutes) {       /* Your solution goes here */    }    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);       double minutes;       minutes = scnr.nextDouble();       outputMinutesAsHours(minutes); // Will be run with 210.0, 3600.0, and 0.0.       System.out.println("");    } } 2....

  • Modify your program in Lab Assignment 4A to throw an exception if the file does not...

    Modify your program in Lab Assignment 4A to throw an exception if the file does not exist. An error message should result.   Use the same file name in your program as 4A, however, use the new input file in 4B assignment dropbox. My code: import java.io.*; import java.util.*; public class Lab4B { public static void main(String[] args) throws IOException { final String input_file = "Lab_4A.txt"; final String output_file = "Lab_4A.txt"; Scanner x = null; FileWriter y = null; try {...

  • In this lab, you complete a partially written Java program that includes methods that require multiple...

    In this lab, you complete a partially written Java program that includes methods that require multiple parameters (arguments). The program prompts the user for two numeric values. Both values should be passed to methods named calculateSum(), calculateDifference(), and calculateProduct(). The methods compute the sum of the two values, the difference between the two values, and the product of the two values. Each method should perform the appropriate computation and display the results. The source code file provided for this lab...

  • In this lab, you complete a partially written Java program that includes two methods that require...

    In this lab, you complete a partially written Java program that includes two methods that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another method that computes the product of all the whole numbers up to...

  • In this lab, you complete a partially written Java program that includes two methods that require...

    In this lab, you complete a partially written Java program that includes two methods that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another method that computes the product of all the whole numbers up to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT