### Source code for SwitchDialPhoneExample.java:

>     public class SwitchDialPhoneExample
>     {
>     	public static void main(String args[])
>     	{
>     		// SwitchDialPhoneExample
>     		String phoneNumber = "1-800-GOJAVA";
>     		for (int i = 0; i < phoneNumber.length(); i++)
>     		{
>     			char letter = phoneNumber.charAt(i);
>     			switch (letter)
>     			{
>     				// Same code from Question c
>     				case 'A': case 'B': case 'C':
>     					System.out.print('2'); break;
>     				case 'D': case 'E': case 'F':
>     					System.out.print('3'); break;
>     				case 'G': case 'H': case 'I':
>     					System.out.print('4'); break;
>     				case 'J': case 'K': case 'L':
>     					System.out.print('5'); break;
>     				case 'M': case 'N': case 'O':
>     					System.out.print('6'); break;
>     				case 'P': case 'Q': case 'R': case 'S':
>     					System.out.print('7'); break;
>     				case 'T': case 'U': case 'V':
>     					System.out.print('8'); break;
>     				case 'W': case 'X': case 'Y': case 'Z':
>     					System.out.print('9'); break;
>     				default:
>     					System.out.print(letter);
>     			}
>     		}
>     		System.out.println();
>     	}
>     }

### Output from SwitchDialPhoneExample.java:

    1-800-465282

--- Output Ends ---

#### NOTE:

You are reading previously generated output. You are not currently running the SwitchDialPhoneExample application at the momement. You need to compile and run the source code first.

#### To run this program:

`
- javac SwitchDialPhoneExample.java
- java SwitchDialPhoneExample
`

Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR