subject

In a bestfriendsimulation driver class, define and initialize a reference variable called mybestfriends referencing an arraylist ofbestfriend objects. then, create a menu that will continue to display itself, and process the requests of the user, until the user requests to exit the menu (loop).the menu should have 5 menu options: 1.) add a bestfriend to the arraylist called mybestfriends; 2.) change a bestfriend in the arraylist; 3.) remove a bestfriend from the arraylist; 4.) display all the objects in the mybestfriends arraylist. 5.) exitfor each of these menu options, be sure to prompt the user for the necessary information such as bestfriend's first name, last name, nickname, and cell phone number. hint: in order to be able to change a bestfriend's information or remove a bestfriend from the arraylist, you will have to create a loop that will search the mybestfriends arraylist from beginning to end, and store the index position of the bestfriend that will be updated or removed. if the desired bestfriend is not found, a -1 will be returned from the search, or a not found flag will be set. if the bestfriend is found, use that index position to either change or remove that object from the mybestfriends arraylist. make sure you test each of your menu options, and then select the option that prints the table immediately afterwards, to ensure the phonebook looks correctly.1. create the bestfriend domain classdefine and/or instantiate the private static and non-static fields. create the constructorpublic class bestfriend{ private static int friendnumber = 0; private int friendidnumber; private string firstname; private string lastname; private string nickname; private string cellphonenumber; public bestfriend (string afirstname, string alastname, string anickname, string acellphonenumber) { firstname = afirstname; lastname = alastname; nickname = anickname; cellphonenumber = acellphonenumber; friendnumber++; friendidnumber = friendnumber; } public string tostring( ) { return friendidnumber + ". " + nickname + " " + firstname + " " + lastname + " " + cellphonenumber; }create the set methods (setters)create the get methods (getters)public boolean equals(object another){ if (another instanceof bestfriend ) { bestfriend anotherbff = (bestfriend) another; if (firstname. equalsignorecase(anotherbff. firstname) & & lastname. equalsignorecase(anotherbff. lastname) // & & nickname. equalsignorecase(anotherbff. nickname) & & // cellphone. equalsignorecase(anotherbff. cellphone)) return true; } return false; }2. create the bestfriendsimulation driver class: instantiate an arraylist called mybffscreate a do …… while loop to create a menu of 5 choices (add, change, remove, display, exit)allow the user to input the choice. use an if statement (or switch) to execute the user’s choice. there are many ways to accomplish this task: technique #1.) create a class that defines the arraylist of bestfriends in its constructor, and then also defines the add, change, display, remove, and error methods as instance methods. instantiate the class from the driver (main) class. also in the driver class, create the loop to display and process the menu options. when any specific menu option is selected, call the method from the class. technique #2.) instantiate the driver class in the main method (instantiate its own self). then, define instance methods in the driver class for the add, change, display, remove, and error methods. call them from the menu loop. technique #3.) in the driver class, create static methods for the add, change, display, remove, and error methods. call them from the menu loop. in any of the above 3 techniques, the arraylist of bestfriends can be defined as a global variable, so that it does not have to be passed as a parameter to each of the add, change, display, remove, and error methods. similarly, the scanner keyboard object should also be defined as a global variable too. the alternative to defining the arraylist and scanner keyboard as global variables is to pass these as parameters to each method call. for example: addbff(mybffs, keyboard); expert answer

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
If you add the following to the query grid in an access query, what is it called? salestaxamt: [salestaxrate]*[totalsale] formula calculated field total calculation
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Type the correct answer in the box. spell all words correctly. what is the default margin width on all four sides of a document? by default, the document has a margin on all four sides.
Answers: 1
You know the right answer?
In a bestfriendsimulation driver class, define and initialize a reference variable called mybestfrie...
Questions
question
Mathematics, 14.02.2021 03:40
question
English, 14.02.2021 03:40
question
Mathematics, 14.02.2021 03:40
question
Mathematics, 14.02.2021 03:40
question
Mathematics, 14.02.2021 03:40
Questions on the website: 13722363