Arrays are zero based, so when you enter 1 for air, you are actually get 4900.0 for your factor instead of 1100.0 like I think you intended and 3 is outside the bounds of your array (your indices are 0, 1, and 2). Decrement choice by 1 and simply assign factor to times[ choice ] instead of using a switch statement.
No comments:
Post a Comment