Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Anyone know a method to accomplish this?

Name: Anonymous 2010-03-19 1:28

Write a program that behaves as follows: a first integer value is input. if negative, program terminates, if not, second integer value is input, and the program repeatedly outputs that second value the number of times indicated by the first value. The process then repeats from the very start.

Format that output as follows: following every three values output, a blank displayed. (careful: the count does not reset between sets of outputs.


so far i made


import java.util.*;

class Assignment91
{
public static void main(String [] args)
{
Scanner keyboard = new Scanner(System.in);
int z=0;
while(z==0)
{    int i, b, a;
System.out.println("Please enter an integer, a negative integer will terminate program");
a = keyboard.nextInt();

if(a<0)
System.exit(1);

System.out.println("Please enter another integer");
b = keyboard.nextInt();

for(i=0; i<a; i++)
System.out.println(b);
}
}
}


thanks MIT  students!

Name: Anonymous 2010-03-19 1:52

I won't help you with your HOMEWORK until you:
  • Figure out how to indent
  • Use code tags so it's actually readable
  • Figure out how to indent your code
  • Use some language that doesn't suck, like Scheme
  • Actually try to do it yourself
  • Figure out how to indent your goddamn code

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List