I'm trying to learn and build my first program. It is a program to work out a cars mpg.
I've created a variable that sets itself to the users iso3 code so when the program is used in different country, I can use it to change other variables in the code - ie. a gallon in the USA and the UK are slightly different so set the correct gallon value for what ever country the program is being used in.
The problem I've got is creating an if
statement to get it to work.
Locale defaultLocale = Locale.getDefault();
String usercountry = (defaultLocale.getISO3Country());
I've tried this:
if (usercountry == USA{
mpg = mpg*0.83;
}
And this:
if (usercountry.equals(USA)){
mpg = mpg*0.83;
}
But both come back saying USA cannot be resolved to a variable. Am I missing something small or am I going about it the wrong way? Thanks in advance.