a. Yummy Catering provides meals for parties and special events. In previous chapters, you have developed an

Question:

a. Yummy Catering provides meals for parties and special events. In previous chapters, you have developed an Event class that holds catering event information. Now modify the Event class as follows:
❯❯Modify the method that sets the event number in the Event class so that if the argument passed to the method is not a four character String that starts with a letter followed by three digits, then the event number is forced to A000. If the initial letter in the event number is not uppercase, force it to be so.
❯❯Add a contact phone number field to the Event class.
❯❯Add a set method for the contact phone number field in the Event class. Whether the user enters all digits or any combination of digits, spaces, dashes, dots, or parentheses for a phone number, store it as all digits. (Assume a phone number is 10 digits and does not require a leading digit that might be needed when dialing.) For example, if the user enters (920) 872-9182, store the phone number as 9208729182. If the user enters a number with fewer or more than 10 digits, store the number as 0000000000.
❯❯Add a get method for the phone number field. The get method returns the phone number as a String constructed as follows: parentheses surround a three-digit area code, followed by a space, followed by the three-digit phone exchange, followed by a hyphen, followed by the last four digits of the phone number. Save the file as Event.java.
b. Create an EventDemo application that does the following:
❯❯Prompts the user for event numbers and numbers of guests and constructs three Event objects.
❯❯Prompts the user for and retrieves a contact phone number for each of the Event objects.
❯❯Displays the event number and contact phone number for each Event. Save the file as EventDemo.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: