Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Limerick Write a program that prints the following limerick with the format show

ID: 3877775 • Letter: L

Question

Limerick Write a program that prints the following limerick with the format shown below. Use only one print/printin method, with string concatenation and escape sequences to achieve the formatted effect. Note: The spaces before the limerick represent tab spaces. The second and fourth lines have extra tab spaces (You can create/use another limerick as long as it is in a format shown below.) Output Sample: (Edit 01/17/18: output edited so tabs are more pronounced Here's a little limerick: There once was a demon named Dante who fought beasts and was cocky all day Then around reboot time he got redesigned, and to his look gamers sald "No way The end

Explanation / Answer

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Surya
*/
public class ex {
  
  
  
public static void main(String argv[])
{
//using only one print method
//string concatenation and escape sequences
//for tab
//for new line
//for quote "
System.out.println("Here's a little limerick: "+" There once was a demon named Dante "+" who fought beasts and was cocky all day "+" Then around reboot time, "+" he got redesigned, "+" and to his gamers said "No way!" "+"This end.");
}
  
  
}

output:

run:
Here's a little limerick:

   There once was a demon named Dante
       who fought beasts and was cocky all day
   Then around reboot time,
       he got redesigned,
   and to his gamers said "No way!"
This end.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote