LogoLogo
  • 🌽Introduction
  • 🤖FRC Basics
    • FTC vs FRC
    • Season Timeline
    • Team Resources
  • 📋Team Administration
  • 💼Business
    • Fundraising
      • Sponsors
      • Other Fundraising Opportunities
    • Recruitment
  • 🏫Outreach
    • Summer Camp Planning Guide
      • Junior Bots
      • Junior Bots Challenge
      • Junior Game Jam
      • Mini Bots Workshops
    • Girl Scouts Robotics Badge
      • Programming Robots
      • Designing Robots
      • Showcasing Robots
    • GoBabyGo Instructions
    • FIRST LEGO League
      • Team Quickstart Guide
  • 🏆Awards
    • Machine Creativity Awards
    • Team Attribute Awards
    • Submitted Awards
      • Impact Award
        • Impact Essay
        • Executive Summaries
        • Judging Interview
        • Sample Questions
        • Binder
        • Video
      • Dean's List Award
      • Woodie Flower's Finalist Award
  • ⚙️Mechanical Design
    • CAD
      • FRC Setup
      • FRC CAD Tutorials
      • OnShape Tutorials
      • Getting Started with OnShape
  • ⚡Electrical
    • Basics
  • ⛑️Safety
    • Safety Glasses
    • Shop Safety
      • Machine Tools
        • Drills
        • Drill Press
        • Band Saw
  • 💻Programming
    • Java Programming
      • What is Java?
      • Hello World
      • Printing and Commenting
        • Project: Face Paint
      • Variables
        • Project: Temperature Converter
      • Conditionals
      • Loops and Recursion
      • Object-Oriented Programming
      • Visibility and Statistics
      • Polymorphism
      • Arrays and Collections
      • Miscellaneous
    • How to Solve Programming Problems
    • Version Control
      • Google Drive
      • Git
        • What is Git?
        • How do you use Git?
        • How to use Git (Option 1): Type commands yourself
        • How to use Git (Option 2): Use GitHub Desktop
    • Web Development
  • 📊Scouting & Strategy
    • Basics of Scouting
  • ⚽Competitions
    • Regionals
      • Setup & Practice Matches
      • Qualifications
      • Alliance Selection
      • Playoff Matches
  • 😀Contribute
Powered by GitBook

Iowa City Robotics 2024

On this page

Was this helpful?

Export as PDF
  1. Programming
  2. Java Programming
  3. Printing and Commenting

Project: Face Paint

This project will test your skills using Repl, printing text to the console, and commenting your code. Since it is the first project of the chapter, it will be fairly brief.

Assignment

The goal of this project is to print the following image and caption to the console:

  /////
 |     |
 | " " |
 | o o |
(|  ^  |)
 | \_/ |
  -----

A "drawing" of a face

To begin, create a Repl called FacePrinting. Find a way to print the text to the console. Even though it is not actually necessary, make use of a mix of println and print statements to get practice with both. You will have to use a few escape sequences in this project. Also, be mindful of the whitespace in the text. For example, there is a blank line between the image and the caption.

Add a multi-line comment at the beginning of your code that contains your name and grade in school. Then, use single-line comments to explain what part of the body is printed by each println and print statement.

Output

This embedded Repl illustrates what your program should print to the console once it works correctly. However, keep in mind that comments are part of this assignment too, so you might not be quite done just because your output looks like this.

Reference Implementation

There are an infinite number of ways to implement this program. However, if you are stuck, you can look at the reference implementation below to see one way of doing it.

Click to reveal the reference implementation
class Main {
  public static void main(String[] args) {
    /*
    Dominic Rutkowski
    12th Grade
    */

    // This statement prints the hair
    System.out.println("  /////");

    // This statement prints the forehead
    System.out.println(" |     |");

    // This statement prints the eyebrows and eyes
    System.out.print(" | \" \" |\n | o o |\n");

    // This statement prints the nose
    System.out.print("(|  ^  |)");

    // This statement prints the mouth
    System.out.println("\n | \\_/ |");

    // This statement prints the chin and a blank line
    System.out.println("  -----\n");

    // This statement prints the caption
    System.out.println("A \"drawing\" of a face");
  }
}
PreviousPrinting and CommentingNextVariables

Last updated 1 year ago

Was this helpful?

💻