Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

What requirement did Health Canada initially require of Aurora?

Answered: 1 week ago

Question

Question What is a secular trust?

Answered: 1 week ago