Exercise 8: 8. Write an application that models a telephone keypad. Use a JPanel
ID: 3689076 • Letter: E
Question
Exercise 8:
8. Write an application that models a telephone keypad. Use a JPanel panel to hold twelve buttons—1, 2, 3, 4, 5, 6, 7, 8, 9, *, 0, # —in the center of a grid layout. Place a blank label in the south location. As each number is pressed, append that digit to the text of the label.
The first number in the number cannot be 0. If the user types 0 as the first number, do nothing with it.
Format the number using dashes, as follows:
1-000-000-0000 if the first digit entered is a 1.
(000) 000-0000 if ten digits are entered.
000-0000 if seven digits are entered.
Do not accept extra digits.
Instructions 1. Name your java program “TelephoneKeypad.java”.