Sure it is a very silly mistake ..
I'll explain why this error is happening to you, which as you say is a very simple thing.
On line 32 you try to use the value SALTA
of enum
Provincia
. At least that is what I interpret that you have tried to do. The failure is very simple, you can not access an element of a enum
without referencing it. If you directly indicate SALTA
, it can not be found as a variable. If you look at it, it's clear to you:
Cannot find symbol
Symbol: variable SALTA
To solve this issue it is not necessary to add the access modifier Public
to the enum Provinces, since you are using the access modifier "Package-Private". This modifier gives you access to all the elements that are in your package, but not to those in higher levels. I'm telling you because you have been recommended to change it to Public
when that will not change anything, since the enum
Provincias
is accessible from the class CasaEmpanadas
. As I was saying, all you have to do is add the reference to enum
Provincias
, I'll put it in code so you can see it.
Before:
System.out.println(PromocionLocal(SALTA, 20, 20));
After:
System.out.println(PromocionLocal(Provincia.SALTA, 20, 20));
With this change the error that you have shown on the screen should be fixed, but it can not be guaranteed that it is the only error, since you have not put more than a screenshot of the code, and a very poor description.
Try changing SALTA
by Provincia.SALTA
on line 32, and set Provincia
(the enum) as public
.
EDIT: Setting Provincia
as public
is not necessary to correct the concrete error shown in the image (as Mario Castillo correctly indicates in his answer), but currently there is a discrepancy between the accessibility of the PromocionLocal
method % (which is public
) and one of its parameters: prov
, which is type Provincia
, which is less accessible than the method. The problem caused by this discrepancy will be visible the day you try to invoke the method from outside the package casaempanadas
. Depending on what you're doing, fixing the detail at once may seem more or less necessary, but it's definitely a bad idea to leave smells or bugs out there.