What Is Programming 2

From CompSciWiki
Jump to: navigation, search

COMP 1010 Home > What_Is_Programming_Questions


Introduction

An exercise to print a story with repetition and special characters.

   

{{{Body}}}

What do you need to know?

  • The story to print. This is a story by little Nancy who was given a task in school, to write a 50-word essay about her pet. Here's what she wrote:
My cat was lost, so I called, "Here, kitty, kitty, kitty. 
Here, kitty, kitty, kitty. Here, kitty, kitty, kitty."
She didn't come, so I went outside and called, "Here, kitty, kitty, kitty.
Here, kitty, kitty, kitty. Here, kitty, kitty, kitty. Here, kitty, kitty, kitty."
Then she came, and I said, "Bad kitty!" and I took her home.
  • How to store a String and use it many times.
  • How to include special characters like a quotation mark and a newline character in a String.

Inputs

No inputs are required.

Outputs

  • The story approximately as shown above.
  • Make sure you start "She didn't come..." and "Then she came..." at the beginning of a line.
  • Use only one call to System.out.println.

Transformation

Since there is no input, no transformation of the input is required.

Solution

Look here.

Template loop detected: Template loop detected: