import java.io.*;

public class Solution
{
    public static void main(String[] args) throws Exception
    {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String name = reader.readLine();
        System.out.print(name+" ");
        String a = "will conquer the world in";
        System.out.print(a+" ");
        String age = reader.readLine();
        int sage = Integer.parseInt(age);
        System.out.print(sage+" ");
        String b = "years. Bwahaha!";
        System.out.print(b);

        /*System.out.println(name+" "+a+" "+sage+" "+b);*/

    }
}

I HAVE TRIED BOTH WAYS... STILL PROGRAM IS OK BUT NOT PASSING THE TEST !! I HAVE TO PRINT THIS :

Write a program that reads from keyboard a name and a number and displays the text: «name» will conquer the world in «number» years. Bwahaha! (The sequence of input data is important.)

Example:
Joe will conquer the world in 8 years. Bwahaha!

MY OUTPUT SO FAR IS

✓ The program is compiled without errors. ✗ The program runs correctly but it has not pass testing. This is program output during runtime:

Joe will conquer the world in 8 years. Bwahaha!

Kindly suggest me please

This question is marked "community wiki".

asked 07 May '15, 05:04

shariq15's gravatar image

shariq15
124
accept rate: 0%


/System.out.println(name+" "+a+" "+sage+" "+b);/ - is good code...

link

answered 08 May '15, 18:12

Hehabr's gravatar image

Hehabr
262
accept rate: 25%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×28
×11

Asked: 07 May '15, 05:04

Seen: 819 times

Last updated: 08 May '15, 18:12