03-23-2014, 03:52 AM
Hello I've got this code, and I hope you can help me out a little bit.
[code2=java]import java.util.Random;
public class objectIntro {
public static void main(String[] args)
{
String a = "blabla";
String b = "lala";
Random weight = new Random();
//Random rnd = new Random();
//System.out.println("The weight is: " + rnd.weight(100));
if(weight <= 55)
{
System.out.println(b + "is slimmer then: "+ a);
}else if(weight >= 80)
{
System.out.println(a + " is fatter then: "+ b);
}
}
}[/code2]
So what does not work?
I want to make the weight int. random and later it can show who is fatter/smaller.
Like the output:
The weight it: (random generated) 83
blabla is fatter then lala
please help me.
GRTZ,
- mustafa6155
[code2=java]import java.util.Random;
public class objectIntro {
public static void main(String[] args)
{
String a = "blabla";
String b = "lala";
Random weight = new Random();
//Random rnd = new Random();
//System.out.println("The weight is: " + rnd.weight(100));
if(weight <= 55)
{
System.out.println(b + "is slimmer then: "+ a);
}else if(weight >= 80)
{
System.out.println(a + " is fatter then: "+ b);
}
}
}[/code2]
So what does not work?
I want to make the weight int. random and later it can show who is fatter/smaller.
Like the output:
The weight it: (random generated) 83
blabla is fatter then lala
please help me.
GRTZ,
- mustafa6155