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();
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
[quote]Use some language that doesn't suck, like Scheme[/quote]
murrharrharrarararharr
Name:
Anonymous2010-03-19 9:02
>>2
You mad because there are no question about your stupid motherfucking fuck language with zero.zero potention? Fuck you. And fuck you too if you post another no-C-framework-to-troll-this-thread. Seriously, you guys need some discipline here. I remember the days when /prog/ was actually a good place to ask such questions. You motherfuckers ruined it by doing this. Ugh. And no, I'm not mad.
>>5
And when was that? It sure wasn't in the past 2 years and since you are likely OP, you're probably just some kid that just started learning Java and needs help with his homework.
I think >>2's guidelines are excellent if you're willing to ask for help on /prog/ as we usually help when the OP uses proper tags, indentation and a language we prefer writing code in.
>>3 Seriously, you guys need some discipline here.
I agree. Discipline like being banned for not seeing anything wrong with lack of code tags and indentation.
Name:
Anonymous2010-03-19 10:09
if(a<0)
System.exit(1);
Your flow control is shit. Learn to flip burgers retard.
>>5 I remember the days when /prog/ was actually a good place to ask such questions.
No you don't. You may remember a time when everyone did ask questions like this, three or four years ago, but that's not the same thing.
You motherfuckers ruined it by doing this.
I strongly disagree that the fact that people aren't putting up with bullshit homework questions where the poster doesn't even give a shit about the other people on /prog/ in any way constitutes ``ruining''.
Look up the archive, /prog/ was never a place where you could ask homework questions and not have someone insult you. Try /pr/ instead... They're happy with homework questions.
public static void main(String [] argv)
{
if (argv.length >= 2)
{
try
{
int a = Integer.parseInt(argv[0]);
int b = Integer.parseInt(argv[1]);
for (int c = 0; c < b; ++c) {
System.out.println(a);
}
}
catch (Exception e)
{
System.out.println("Invalid arguments, " + e);
}
}
else
{
System.out.println("Insufficent arguments");
}
}