I have done thorough research on this topic but cannot seem to find anything on exactly what I'm after. I am creating a toll invoice (for a school assignment) which requires users to input data via the scanner to be saved under the relevant string and int variables to be called upon at a later time. The issue I'm facing is whilst creating if statements. I have an if statement for the type of vehicle being entered into the system, if it is a Heavy Vehicle (HCV) the user will be prompted to enter the relevant trip time which is then saved into the String "uTripTime."
However from here the String "uTripTime" cannot be recalled later in my code.
The only thing I can assume is that because an if statement is a separate code block the user input being stored in the String 'uTripTime' is only stored within that code block. Is there any way to use this variable later in my code?
Sorry if the format of my question isn't correct, my first time asking a question here.