Ask coding questions

← Back to all posts
what I do?
Victorcbtis (0)

Friends, I am from México and I am a new programmer and I want to dedicate myself to this, so I need your help, look, it gives me this "cannot find symbol" and I don't know what to do

Comments
hotnewtop
ANDREWVOSS (187)

Put double descuentodelaprenda; at the start of main()

DynamicSquid (4912)

For your if statement, put your variable outside like this:

// don't do this

if(numeroproductos>3){
    System.out.println("Hay descuento del 10%");
    descuento=10;
    double descuentodelaprenda=(descuento*costoproductos/100)-costoproductos;
}

// do this

double descuentodelaprenda;
if(numeroproductos>3){
    System.out.println("Hay descuento del 10%");
    descuento=10;
    descuentodelaprenda=(descuento*costoproductos/100)-costoproductos;
}

If you want to know why, I can explain it to you in greater depth

ruiwenge2 (576)

i dont know anything about java but maybe descuentodelaprenda isn't defined?