Hello, I've attached the prompt for this assignment. I need help creating code to delete and update in the contactService.java according to the prompt. This is my partial code.  package Contact; import java.util.ArrayList; public class ContactService { //Start with an ArrayList of contacts to hold the list of contacts     ArrayList contactList = new ArrayList();     //Display the full list of contacts to the console for error checking.     public void displayContactList() {         for(int counter = 0; counter < contactList.size(); counter++) {

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter6: Managing Multiple Worksheets And Workbooks
Section: Chapter Questions
Problem 21RA
icon
Related questions
Question

Hello, I've attached the prompt for this assignment. I need help creating code to delete and update in the contactService.java according to the prompt. This is my partial code. 

package Contact;

import java.util.ArrayList;

public class ContactService {
//Start with an ArrayList of contacts to hold the list of contacts
    ArrayList<Contact> contactList = new ArrayList<Contact>();

    //Display the full list of contacts to the console for error checking.
    public void displayContactList() {
        for(int counter = 0; counter < contactList.size(); counter++) {
        System.out.println("\t Contact ID: " + contactList.get(counter).getContactID());
        System.out.println("\t First Name: " + contactList.get(counter).getFirstName());
        System.out.println("\t Last Name: " + contactList.get(counter).getLastName());
        System.out.println("\t Phone Number: " + contactList.get(counter).getNumber());
        System.out.println("\t Address: " + contactList.get(counter).getAddress() + "\n");
    }
}
    //Adds a new contact using the Contact constructor, then assign the new contact to the list.
    public void addContact(String firstName, String lastName, String number, String address) {
        // Create the new contact
        Contact contact = new Contact(firstName, lastName, number, address);
        contactList.add(contact);
        }

This is my completed Contact.java

 

Prompt
For Project One, which is due in Module Six, you are asked to develop a mobile application for a customer. The customer will provide you with the
requirements. Your job is to code the application and provide unit tests to verify that the application meets the customer's requirements. For this
milestone, you will focus on delivering the contact services. The purpose of these services is to add, update, and delete contact objects within the
application.
The contact service uses in-memory data structures to support storing contacts (no database required). In addition, there is no user interface for
this milestone. You will verify the contact service through JUnit tests. The contact service contains a contact object along with the contact service.
The requirements are outlined below.
Contact Class Requirements
●
The contact object shall have a required unique contact ID string that cannot be longer than 10 characters. The contact ID shall not be null
and shall not be updatable.
●
The contact object shall have a required firstName String field that cannot be longer than 10 characters. The firstName field shall not be null.
The contact object shall have a required lastName String field that cannot be longer than 10 characters. The lastName field shall not be null.
●
●
The contact object shall have a required phone String field that must be exactly 10 digits. The phone field shall not be null.
●
The contact object shall have a required address field that must be no longer than 30 characters. The address field shall not be null.
Contact Service Requirements
The contact service shall be able to add contacts with a unique ID.
• The contact service shall be able to delete contacts per contact ID.
The contact service shall be able to update contact fields per contact ID. The following fields are updatable:
O firstName
O lastName
。 Number
• Address
Transcribed Image Text:Prompt For Project One, which is due in Module Six, you are asked to develop a mobile application for a customer. The customer will provide you with the requirements. Your job is to code the application and provide unit tests to verify that the application meets the customer's requirements. For this milestone, you will focus on delivering the contact services. The purpose of these services is to add, update, and delete contact objects within the application. The contact service uses in-memory data structures to support storing contacts (no database required). In addition, there is no user interface for this milestone. You will verify the contact service through JUnit tests. The contact service contains a contact object along with the contact service. The requirements are outlined below. Contact Class Requirements ● The contact object shall have a required unique contact ID string that cannot be longer than 10 characters. The contact ID shall not be null and shall not be updatable. ● The contact object shall have a required firstName String field that cannot be longer than 10 characters. The firstName field shall not be null. The contact object shall have a required lastName String field that cannot be longer than 10 characters. The lastName field shall not be null. ● ● The contact object shall have a required phone String field that must be exactly 10 digits. The phone field shall not be null. ● The contact object shall have a required address field that must be no longer than 30 characters. The address field shall not be null. Contact Service Requirements The contact service shall be able to add contacts with a unique ID. • The contact service shall be able to delete contacts per contact ID. The contact service shall be able to update contact fields per contact ID. The following fields are updatable: O firstName O lastName 。 Number • Address
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage