Hi i have written a program to identify all the vowels in a sentance and need to output the number as Stars. at the moment it is outputting the number how would i tell the program to output 5 stars instead of the number 5
this is what i have written so far.

// filename VowelCounter.java
// Created Fri 5th nov 2004
// Counts vowels in a sentance
// I really dont understand this stuff

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class VowelCounter

{
    public static void main(final String[] pArgs) throws IOException

    {

        final InputStreamReader tInputStreamReader = new InputStreamReader(System.in);
        final BufferedReader tKeyboard = new BufferedReader(tInputStreamReader);
    // get user to input a sentance
        System.out.println(" this will count how many vowels are in a sentance");
        System.out.println(" Please enter a Short sentance");

        String tString = tKeyboard.readLine();
        String tNewString = tString.toLowerCase();

    // counts characters in sentance
        int tStringLength = tNewString.length();

        int tVowA = 0;
        int tVowE = 0;
        int tVowI = 0;
        int tVowO = 0;
        int tVowU = 0;
        int tOtherChar = 0;

    //begin for loop
        for (int tCounter = 0; tCounter < tStringLength; tCounter ++)
        {
        char tVow = tString.charAt(tCounter);
    //end for loop begin if statement
        if (tVow =='a')
            {
                tVowA ++;
            }
        else if (tVow =='e')
            {
                tVowE ++;
            }
        else if (tVow =='i')
            {
                tVowI ++;
            }
        else if (tVow =='o')
            {
                tVowO ++;
            }
        else if (tVow =='u')
            {
                tVowU ++;
            }
        else if (tVow !=' ')
                {
                    tOtherChar ++;
                }
        }
    // end if statement


        System.out.println ("A: " +tVowA);
        System.out.println ("E: " +tVowE);
        System.out.println ("I: " +tVowI);
        System.out.println ("O: " +tVowO);
        System.out.println ("U: " +tVowU);
        System.out.println ("tOther Characters: " +tOtherChar);
    }
}

any help and or advice would be much appreciated

Edited 3 Years Ago by Dani: Formatting fixed

>how would i tell the program to output 5 stars instead of the number 5

for ( int i = 0; i < 5; i++ )
  System.out.print ( "*" );

:) hi Naru thanks for the code i figured it in class and didn't have to use the code you sent but thanks anyway

This article has been dead for over six months. Start a new discussion instead.