java programming help im so stupid?

Write an

application that reads five numbers between 1 and 30. For each number that is read,

your program should display the same number of adjacent asterisks. For example, if

your program reads number 7, it should display *******

3 Answers

  • 1 decade ago
    Favorite Answer

    Thats easy!

    i'll write it right now:

    public static void main(String[] args) {

    int a;

    for(int i=0;i<7;i++){// keeps going for 7 times


    )("Enter a Number between 1-30"));

    //(Note:when you copy the above 2 lines they ONE LINE,NO SPACES, should read"...Dialog("enter number...." )

    //JOptionPane is used for user input.

    while(a>30 | a<0){//acts like anti fraud checker


    (JOptionPane.showInputDialog("Try again"));

    //(Note:when you copy the above 2 lines they ONE LINE,NO SPACES, should read"...Dialog("try again......" )


    System.out.println("You have entered:" + a);//shows the number entered

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







    Just copy and paste, lol and read below

    Yahoo answers is so gay it wont let me enter long sentences. so i had to break then into two sentences, look where it says "NOTE:" thats where you combine the two sentences above. Sorry for the mess(actually thats coz of yahoo answers)

    This program makes sure the person is entering a number between 0-30 too(unlike the other dude) and mine has uses more sophisticated

  • 1 decade ago

    That sound like a homework problem. But here it goes.

    Scanner in = new Scanner(;

    System.out.println("Enter a number from 1 to 30");

    int num = in.nextInt();


    while(num > 0 || num < 31){

    for(int i = 1; i <= num; i++)





    Source(s): me
  • 1 decade ago

    both wrong answers. it has to output the number given to it in asterisks





Still have questions? Get your answers by asking now.