Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SplitZip: Write an application that prompts the user to enter in a 10 character zip code with a - between the two sections, such as

SplitZip: Write an application that prompts the user to enter in a 10 character zip code with a - between the two sections, such as 49442-1432 Use the split() method to separate the zip code into its two parts and display them separately.

package pack1; import javax.swing.*; public class SplitZip { public static void main(String[] args) { String inputString; String newString; inputString = JOptionPane.showInputDialog(null, "Enter a Zip Code" + " as a series of 10 digits" + " and I will display it in a nice format" + " Enter 999 to quit"); while(!inputString.equals("999")) { newString = inputString.substring(0,6) + '-' + inputString.substring(6,10) ; String[] newerString = newString.split("-"); for(String temp :newerString ) { inputString = JOptionPane.showInputDialog(null, "The number is " + temp + " Enter azip code" + " as a series of 10 digits " + " and I will display it in a nice format" + " Enter 999 to quit"); } } System.exit(0); } }

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

ul Write the term for the clear area around the VA 3 0 disc

Answered: 1 week ago

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago