Welcome to the Ranch!
On line 6 you declare 4 variables,
c,
sw,
random and
n. These all have the same type,
int.
int is one of the primitive types in
Java which means it does not have any methods or fields you can call using the dot operator.
You are calling
n.nextInt(47);. There are two methods called
nextInt that take a single
int value - one in java.util.Random and one in java.util.Scanner. Since in the latter the
int is the radix I assume you actually want the former. For that you would need an instance of java.util.Random.
I think that line 6 is actually a mistake; either you copied it incorrectly or your teacher made a mistake. I think it should be this:
And can you please
UseCodeTags next time? Make sure to preserve the indentation as well.