Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your output should look like this: Exercise 1: New Sales Tax in Metro Atlanta Area (10pt) Starting from April 1, 2018, the sales tax rates

image text in transcribedimage text in transcribedimage text in transcribedYour output should look like this:image text in transcribed

Exercise 1: New Sales Tax in Metro Atlanta Area (10pt) Starting from April 1, 2018, the sales tax rates in the metro Atlanta area have been increased to the following: County Inside City of Atlanta? Sales Tax Rate Yes 8.9% Fulton No 7.75% Yes 8.9% Dekalb No 8.0% Cobb N/A 6.0% C. Command Prompt C:\test>javac Hw3_Ex1.java C:\test>java Hw3_Ex1 County (1. Fulton; 2. Dekalb; 3. Cobb): 1 Inside City of Atlanta? (1. Yes; 2. No): 1 The sales tax rate is: 8.9% C:\test>java Hw3_Ex1 County (1. Fulton; 2. Dekalb; 3. Cobb): 2 Inside City of Atlanta? (1. Yes; 2. No: 2 The sales tax rate is: 8.0% C:\test>java Hw3_Ex1 County (1. Fulton; 2. Dekalb; 3. Cobb>: 3 The sales tax rate is: 6.0% C:\test> 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; C:\. Command Prompt C: \test>javac Hw3_Ex2.java C:\test/java Hw3_Ex2 County (1. Fulton; 2. Dekalb; 3. Cobb): a Invalid input! C:\test>java Hw3_Ex2 County (1. Fulton; 2. Dekalb; 3. Cobb): 4 Invalid input! C:\test>java Hw3_Ex2 County (1. Fulton; 2. Dekalb; 3. Cobb): 1 Inside City of Atlanta? (1. Yes; 2. No): b Invalid input! C:\test>java Hw3_Ex2 County (1. Fulton; 2. Dekalb; 3. Cobb): 1 Inside City of Atlanta? (1. Yes; 2. No: 0 Invalid input! C:\test>java Hw3_Ex2 County (1. Fulton; 2. Dekalb; 3. Cobb): 2 Inside City of Atlanta? (1. Yes; 2. No): 2 The sales tax rate is: 8.0% C:\test>

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

Step: 3

blur-text-image

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions