i wanted the number of asterisk be equal to the number entered by the user. here's my sourcecode...
Code:import java.io.*;
class ForLoopRequirement
{
public static void main (String [] args) throws Exception
{
BufferedReader inputNo= new BufferedReader (new InputStreamReader (System.in));
int survey1, survey2, x, y;
String result1=" ", result2=" ";
System.out.println ("How would you rate your computer programming subject? ");
survey1= Integer.parseInt(inputNo.readLine());
System.out.println ("How about your instructor? ");
survey2 = Integer.parseInt(inputNo.readLine());
System.out.println ("Computer Programming:");
for(x=0;x<=survey1;x++)
{
result1=result1+"*";
System.out.print (result1);
}
System.out.println (" ");
System.out.println ("Instructor:");
for(y=0; y<=survey2;y++)
{
result2=result2+"*";
System.out.print (result2);
}
}
}
the output will always be :
How would you rate your computer programming subject?
5
How about your instructor?
6
Computer Programming:
* ** *** **** *****
Instructor:
* ** *** **** ***** ******
i wanted it like this
How would you rate your computer programming subject?
5
How about your instructor?
6
Computer Programming:
*****
Instructor:
******

