
-----------------------------------
iBIGTRAIN
Tue Jul 21, 2009 8:48 pm

Help With Loop's
-----------------------------------
Im doing an online class about computer science and I have an exam tommrow, this assignment will give me extra marks. Ive got a basic idea on what I have to do for the assignment. I got most of the code right but it's just the last line that im haveing some trouble with.

Write a program that asks the user to enter a word. The program will then repeat the word for as many times as it has characters: 

Sample Output 

Enter a word : Hello 

It has a length of 5 characters.

Hello Hello Hello Hello Hello

This is my code but it dosent work and I dont know what els I can put to make it work, ive been doing to for two days and im extremly angery.

// The "IntegersOne" class.
import java.awt.*;
import hsa.Console;

public class IntegersTwo
{
    static Console c;           // The output console
    
    public static void main (String[] args)
    {
        c = new Console ();

       String word;
       int letters;
       
       c.println ("Please enter a word");
       word = c.readLine();
       letters = word.length();
       {
       System.out.println(letters+word);
       }

-----------------------------------
Analysis Mode
Tue Jul 21, 2009 8:54 pm

Re: Help With Loop's
-----------------------------------
something like this will do:  (C++ syntax)

for (i=0;i