a. Sunshine Seashore Supplies rents beach equipment to tourists. In previous chapters, you have developed a Rental class that holds equipment rental information. Now modify the Rental class as follows: Modify the method that sets the contract number in the Rental 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 contract number forced to A000. If the initial letter in the contract number is not uppercase, force it to be so. Add a contact phone number field to the Rental class. Add a set method for the contact phone number field in the Rental 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 Rentaljava. b. Create a RentalDemo application that does the following: Prompts the user for a contract number and number of minutes for three Rental objects. Prompts the user for and retrieves a contact phone number for each of the Rental objects. Displays the contract number and contact phone number for each Rental. Save the file as RentalDemo.java.
a. Sunshine Seashore Supplies rents beach equipment to tourists. In previous chapters, you have developed a Rental class that holds equipment rental information. Now modify the Rental class as follows: Modify the method that sets the contract number in the Rental 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 contract number forced to A000. If the initial letter in the contract number is not uppercase, force it to be so. Add a contact phone number field to the Rental class. Add a set method for the contact phone number field in the Rental 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 Rentaljava. b. Create a RentalDemo application that does the following: Prompts the user for a contract number and number of minutes for three Rental objects. Prompts the user for and retrieves a contact phone number for each of the Rental objects. Displays the contract number and contact phone number for each Rental. Save the file as RentalDemo.java.
Chapter2: Using Data
Section: Chapter Questions
Problem 9PE
Related questions
Question
100%
Please help me this I need answer typing clear urjent no chatgpt used i will give 5 upvotes
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,