This program contains a lot of redundancy when taking in input, error checking, and performing calculations. I want to refactor it such that cases do not need to repeat the input code and error check each time. My goal is to make the code more efficient by creating a function to handle user input and store the data in an array that the calculations can iterate through.
This program contains a lot of redundancy when taking in input, error checking, and performing calculations. I want to refactor it such that cases do not need to repeat the input code and error check each time. My goal is to make the code more efficient by creating a function to handle user input and store the data in an array that the calculations can iterate through.