Tuesday, 1 April 2014

Why is my formula controlling a for loop some-more than 5 times?

I sound unequivocally stupid for seeking this, though I'm carrying problem
with my for loop.Here is partial of a formula I'm carrying problem
with.Scanner quarrel = new Scanner( System.in);int number;for(int i = 0;i
< 5;i++) { System.out.print("Enter 5 integers:"); series =
input.nextInt();}When we run it a imitation out loops some-more than 5
times.public category BarGraph extends JPanel{ open vacant
paintComponent( Graphics g ) { Scanner quarrel = new Scanner(
System.in); // super.paintComponent(g); int number;
for(int i = 0;i < 5;i++) { System.out.print("Enter 5
integers:"); series = input.nextInt(); // g.drawRect(10 * i,
10 * i, 100 * number, 10); } }}Running BarGraphTestpublic
category BarGraphTest{ open stationary vacant main( String[] args) {
BarGraph quarrel = new BarGraph(); JFrame concentration =
new JFrame(); application.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE ); application.add( quarrel );
application.setSize( 300, 300); application.setVisible( loyal );
}}Basically what I'm perplexing to do is review 5 integers and only
arrangement them on JPanel line a bar graph.

No comments:

Post a Comment