Post any thoughts or questions you have about the Integer Calculator lab assignment here.
Questions and Answers from Pre-lab Assignment:
I have tried to encapsulate all of the questions asked on the pre lab assignment that were relevant to this lab. If your question was not answered, please post it in the comments.
Q: If the user inputs bad data, do you want us to exit or show error messages and restart the program?
A: The answer to this is in the write up specification under the Requirements section: "If the user enters too few or too many arguments or an invalid argument the program prints the usage." Also, because you are receiving input from the command line it does not make sense to restart the program this would result in the same input.
Q: What does isOp() return?
A: Because it is not specified in the write up specification it may return anything you want. However, it is good practice to have methods starting with isX and hasX to return booleans.
Q: Once the program prints usage does it end or restart the program?
A: Your program should exit if invalid input is given to it. It does not make sense to restart the program because you are receiving the input from the command line.
Q: Are we only calculating ints?
A: Yes.
Q: Should we print a statement for each error?
A: This is not specified in the write up. It is generally good practice to do this so the user knows what they did wrong. However, you will not be docked points for not doing this.
Q: What if the user adds spaces in between the arguments of the String?
A: Because we are taking input from the command line you *should* receive 3 Strings if the input is correct. Each of these Strings should not contain any spaces. If they do, that would be invalid input.
Q: What is parsing?
A: To interpret something. In our case, we are parsing Strings to ints using the Integer.parseInt() method. Also, we must parse a String to see if it contains a valid operation
Q: What is op?
A: This is just an abbreviation for operation.
Q: What does it mean to be a static method?
A: A static method is associated with the class rather than the instance of the class. For the purposes of the Integer Calculator assignment just assume all methods need this.