Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 2: Input Validation: Exercise 1 Revisited (10pt) In all exercises up until now, we simply assume all user inputs follow the supposed format and
Exercise 2: Input Validation: Exercise 1 Revisited (10pt) In all exercises up until now, we simply assume all user inputs follow the supposed format and will always be valid. In real software applications, we need to account for possible invalid user inputs and make sure our programs are robust enough. In this exercise, let us revisit Exercise 1 (Sales Tax Rate) and add input validation to the program you just wrote. Save the improved program in a separate file as Hw3_Ex2.java. Your program needs to do the following input validations: (i) If the user's entry for the county is NOT an integer, display an error message and terminate the program immediately; (ii) If the user's entry for the county is an integer, but not between 1 and 3, then display an error message and terminate the program immediately; (iii) If the user's entry for whether inside Atlanta is NOT an integer, display an error message and terminate the program immediately; (iv) If the user's entry for whether inside Atlanta is an integer, but not 1 or 2, then display an error message and terminate the program immediately
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started