Carlys Catering provides meals for parties and special events. You have developed a class that holds catering

Question:

Carly’s Catering provides meals for parties and special events. You have developed a class that holds catering event information and an application that tests the methods using four objects of the class. Now modify the Event and EventDemo classes 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. 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.
  • Modify the EventDemo program so that besides the event number and guests, the program also prompts the user for and retrieves a contact phone number
    for each of the sample objects. Display the phone number along with the other Event details. Test the EventDemo application to make sure it works correctly with valid and invalid event and phone numbers. Save the files as Event.java and 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: 978-1337397070

9th edition

Authors: Joyce Farrell

Question Posted: