Question: Q1. (100 pts.) Making Calculator fool-proof Consider the Calculator class given in Listing 9.5 of the textbook. Your task is to make this program fool-proof:

 Q1. (100 pts.) Making Calculator fool-proof Consider the Calculator class givenin Listing 9.5 of the textbook. Your task is to make thisprogram fool-proof: any exceptions that may be generated at run-time will be

Q1. (100 pts.) Making Calculator fool-proof Consider the Calculator class given in Listing 9.5 of the textbook. Your task is to make this program fool-proof: any exceptions that may be generated at run-time will be resolved, any invalid input will be corrected through additional user prompts (i.e., ask for another input value) and all problems encountered during execution will be logged into a log file. A (possibly incomplete) list of cases you should code against is as follows: An operand that cannot be cast to double, .Unsupported operator, . Log file cannot be opened for writing Division by 0 Number of arguments is not exactly 3. Add more cases to this list as you see necessary. Name the log file "calculatorLog.txt" and insert a single line of explanation into this file for every problematic case that has been caught. A sample log file might look like this: The first operand was "hello" - program expected a number. The operator was "%"-only +,-, *, / are supported. Division by 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!