Question

Program: ASCII art

1.16 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 \nSo, to print an actual backslash, escape that backslash by prepending another backslash. Ex: The following prints a single backslash: System.out.println("\\");


1 0
Add a comment Improve this question Transcribed image text
Answer #1
public class AsciiArt {

   public static void main(String[] args) {
      
      System.out.println("   *");
      System.out.println("  ***");
      System.out.println(" *****");
      System.out.println("*******");
      System.out.println("  ***");
      
      System.out.println("\n");
      
      System.out.println("/\\   /\\");
      System.out.println("  o o");
      System.out.println(" =   =");
      System.out.println("  ---");
      
   }
   
}


Add a comment
Know the answer?
Add Answer to:
Program: ASCII art
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
  • Need the answer in Java 1.17 LAB*: Program: ASCII art This zyLab activity is the traditional...

    Need the answer in Java 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...

  • 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...

  • 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.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...

  • write a C++ program that reads the gallery's inventory from a file called ArtFile.txt or ArtFile.csv...

    write a C++ program that reads the gallery's inventory from a file called ArtFile.txt or ArtFile.csv into the array of artist struct. Then allow the user to look up the art by specifying any field in the record. [The file extracted a selected number of art works from the National Gallery of Art: NGS.gov.] The user should be able to specify a field, and a value for that field, and the program then returns all artworks that match those criteria....

  • C language huffman This exercise will familiarize you with linked lists, which you will need for...

    C language huffman This exercise will familiarize you with linked lists, which you will need for a subsequent programming Getting Started assignment Overview Requirements Getting Started Submit Start by getting the files. Type 264get hw13 and then cd hw13 from bash. Pre-tester You will get the following files: Q&A Updates 1. huffman.h: An empty header file, you have to define your own functions in this homework. 2. huffman.c: An empty c file, you have to define your own functions in...

  • Please create a class in Java that completes the following conditions MorseTree.java /* This program will...

    Please create a class in Java that completes the following conditions MorseTree.java /* This program will read in letters followed by their morse code * and insert them properly in a tree based on the amount of symbols * it has and whether they are left or right descendent. Finally * it prints a few certain nodes. */ import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class MorseTree {    public static void main(String[] args) throws FileNotFoundException {        //...

  • Writing Unix Utilities in C (not C++ or C#) my-cat The program my-cat is a simple...

    Writing Unix Utilities in C (not C++ or C#) my-cat The program my-cat is a simple program. Generally, it reads a file as specified by the user and prints its contents. A typical usage is as follows, in which the user wants to see the contents of my-cat.c, and thus types: prompt> ./my-cat my-cat.c #include <stdio.h> ... As shown, my-cat reads the file my-cat.c and prints out its contents. The "./" before the my-cat above is a UNIX thing; it...

  • Create a program that performs the following operations: 1. Prompt for and accept a string of...

    Create a program that performs the following operations: 1. Prompt for and accept a string of up to 80 characters from the user. • The memory buffer for this string is created by: buffer: .space 80 #create space for string input The syscall to place input into the buffer looks like: li $v0,8 # code for syscall read_string la $a0, buffer #tell syscall where the buffer is li $a1, 80 # tell syscall how big the buffer is syscall 2....

  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

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