Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read in the various parts of a user's address. Determine if each address component is valid. The rules for each component are listed below. If

Read in the various parts of a user's address. Determine if each address component is valid. The rules for each component are listed below. If the user enters invalid data, output the reason to the user. If the address is valid, determine if a company can ship to them and at what speed.
Address Component Rules Examples
street
must start with a digit (see provided code below)
must be at least three characters long
valid: 13 Main St.
invalid: Center Ave
invalid: 5A
city
cannot be empty
valid: San Francisco
valid: Buffalo
invalid:
state abbreviation
must be two characters long
program should ignore capitalization
fast shipping to states: CT, ME, MA, NH, RI, and VT
regular shipping to states: NY, NJ, PA
no shipping to any other state
suggestion: use a switch statement for the shipping speed!
valid and fast: me
valid and fast: nh
valid and slow: Pa
invalid: California
invalid: c
zip code
must be five characters long
all characters must be a digit
valid: 12345
valid: 02460
invalid: 1234
invalid: 123456
invalid: abcde
invalid: 1234z
In order to test whether a single character is a digit, use:
Character.isDigit(ch); // ch is type char
Note that ch must be char, it cannot be a String of length 1.
create a java program address validator

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

L A -r- P[N]

Answered: 1 week ago