***AFTER TESTING -- THIS IS THE ERROR ***
Failure: junit.framework.ComparisonFailure: null expected:<[unrecognized token:]$> but was:<[]$>
Hello Everyone, i need some help about throwing an exception in my Junit Test
I am trying throw an exception and pass the test, when the input String found the symbol $
Any Suggestion??
Hello Everyone, I need some help about this particular program
concisting in analyze the type of shape and output the shape : "("Tree", 8,"*")
I was thinking to create a loop and checking if the first character is blank or
checking the new line to to figure it out the height of the shape and compare it...
Any help, very confusing...
thanks
Hello everyone, sorry i could not answer back right away, and thank you for your answers
I just changed the conditionals, using switch and char variables in order to campare , win = w, lose = l, continue = c.
* BUT It returns WRONG answers , when it is NOT a win or a lose MEANS, when it is continue.
* i would like you take a look at the second time when generate the numbers, i use different variable "ddado1" and "ddado2"
because if i continue with the originals "dado1" and "dado2" i got a error, saying that dado1 and dado2 are already define in main(java.lang.String[])
ANY HELP PLEASE.
import java.util.Scanner;
import java.lang.String;
import java.util.Random;
public class Craps
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
String answer;
char stat = ' ';
char gamestat = ' ';
int roll2 = 0;
do
{
Die dado1 = new Die();//store roll1 in a new var1
Die dado2 = new Die();//store roll2 in a new var2
// my point V iqual the sum of the two rolls
int thePoint = (dado1.getRoll() + dado2.getRoll());
System.out.println();
System.out.print("You rolled "+thePoint+" . ");
switch (thePoint)
{
case 7:
case 11:
System.out.println("You Win !");// winner
stat = 'w';
gamestat = stat;
break;
case 2:
case 3:
case 12:
System.out.println("You Lose !");// loser
stat = 'l';
gamestat = stat;
break;
default:
stat = 'c';
gamestat = stat;
break;
}
while ( gamestat == 'c' )
{
Die ddado1 = new Die();//store roll1 in a new var1
Die ddado2 = new Die();//store roll2 in a new var2
roll2 = (ddado1.getRoll() + ddado2.getRoll());
if (roll2 == thePoint){
gamestat = 'w';
System.out.println("You Winnnnn !");
}else if (roll2 == 7){
gamestat = 'l';
System.out.println("You Looooose !");
}
}
*******************************************************
// random numbers class
mport java.util.Random;
public class Die
{
private int tiro;
private final static Random random = new Random();
public Die()
{
tiro =random.nextInt(6) + 1;
}
public int getRoll()
{
return tiro;
}
}
Hello everyone, i really need some help in this code "craps game"
thi is the error message i got when i compile, i think im doing somenthing wrong in my class Die
it remarks that public int getRoll() , illegal start of expression
Hi, in this program, supposed to add odd numbers
it works when num1 <= numb2 : "10, 1"
but when you enter num1 >=numb2 : "10,1" does not work and theres no errors
what condition i have to add (when numb1>=numb2) and where i have to locate it.
Thanks
Thanks a lot, I understand now...about Math.class... But my doubt is about the exponent ' 1/2 '. Using the same equation, if I want to elevated it to exponent 1/2, what Math.class should I use n which one is the correct one.
Math.sqrt or Math.pow ??
Jesper the jonq, actually , i want to square root the whole equation, an\d is 331
Rob Spoor and Campbell Ritchie: so can i use math.pow in this particular ecuation or just math.sqrt
and can you tell if this is right or wrong : 331*(math.sqrt((t*273)/273) or can you guys write this ecuation using math class please.