Hi guys I have fixed the initial problem but now its not adding up correctly. I am unsure what to do and where I have gone wrong. Any help would be appreciated.
import j
maybe you trying to do something like this:
public int someMethod(){
int childTotal; // here variable must be initialized before return
// like this int childTotal = 0;
switch (option) {
case 1:
childTotal=(int) ((double) quantity*childCost) ;
System.out.println("Total amount for child tickets: $" + childTotal);
break;
}
...
return childTotal;
}
in this case you'll get an error, that variable must be initialized.
Anyway you gave to few information about your problem. Maybe you can show what kind of answer you get from the system, stackTrace or something like that. Did you know about diference between initialize and declare?