1
0

please make your compiler testing checks correct. and if they r then please tell me the fault in this program : here is my code:

package com.javarush.test.level04.lesson13.task05;

import java.io.*;

/* Everybody loves somebody
Write a program that reads from keyboard name. Use “for” loop to display 10 times the text:
    «name» loves me.

    Example text:
    Pam loves me.
    Pam loves me.
    …
*/

public class Solution

{

    public static void main(String[] args) throws Exception

    {

         BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

            String m,n;

            m= r.readLine();

           for(int a=0; a < 10; a++){

               System.out.println(m+" loves me.");

           }

    }
}

and here is the output ......

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

Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me. Pam loves me.

asked 14 Mar '15, 03:54

alimujtaba's gravatar image

alimujtaba
1115
accept rate: 0%

edited 14 Mar '15, 08:50

Elleonora%20Carry's gravatar image

Elleonora Carry ♦♦
275


Now it's a bug. Will be fixed soon.

Please write (m+"loves me.") i.e. delete the space between name and 'loves'

link

answered 14 Mar '15, 08:49

Elleonora%20Carry's gravatar image

Elleonora Carry ♦♦
275
accept rate: 16%

yes, there was bug... according to you i just finished space between "pam"and "loves me." although in the question it was required, but now it is done. thanks

(14 Mar '15, 10:02) alimujtaba

Why did you write n variable

link

answered 14 Mar '15, 04:25

Joseph's gravatar image

Joseph
213
accept rate: 0%

this was not the issue.... thanks 4 your reply

(14 Mar '15, 10:01) alimujtaba
  1. Delete n at the 7 line. You don't use this reference in your program.
  2. Your result is strange. Your programme print each sentence from new line. But you wrote that all sentence on one line after programme. All sentence must be on new line.
link

answered 14 Mar '15, 04:31

RabenokDmitry's gravatar image

RabenokDmitry
1263
accept rate: 14%

package com.javarush.test.level04.lesson13.task05;

import java.io.*;

/* Everybody loves somebody Write a program that reads from keyboard name. Use “for” loop to display 10 times the text: «name» loves me.

Example text:
Pam loves me.
Pam loves me.
…

*/

public class Solution { public static void main(String[] args) throws Exception { //add your code here BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Введите имя:"); String name = reader.readLine();

    for (int i = 0; i < 10; i++)
    {
        System.out.println(name + "loves me.");
    }

}

}

The program has not passed testing

link

answered 24 Nov, 04:22

triumphatorius's gravatar image

triumphatorius
111
accept rate: 0%

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:

×1

Asked: 14 Mar '15, 03:54

Seen: 883 times

Last updated: 24 Nov, 04:22

Related questions