Question

: Implement your toString method. The output should be in the format ik Name: (Phone Number: ) *For example, if a contact has the first name John, last name Doe and middle name Xavier, and the phone number 123-456-7890, this should return: ik Name: Doe, John Xavier (Phone Number: 123-456-7890) *Do not insert new line character after the last digit of the phone number ik public String toStringO t

Background information:

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public String toString() {
    return String.format("Name: %s (Phone Number: %s)", name.toString(), phoneNumber);
}
Add a comment
Know the answer?
Add Answer to:
Background information: : Implement your toString method. The output should be in the format ik Name:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Make the following modifications/enhancements to Version 0 of the Phonebook application: The phonebook should now contain...

    Make the following modifications/enhancements to Version 0 of the Phonebook application: The phonebook should now contain a first name as well as a last name. The format of the entries in the file should be: last-name first-name phone-number The lookup process now prompts for both a last and a first name A reverse lookup should also be provided, allowing a name to be obtained by supplying the phone number. Rather than continuing until the user signals end-of-file (at the keyboard),...

  • using C#, implement classes as shown below: Ready to pay as 4 questions for this (not...

    using C#, implement classes as shown below: Ready to pay as 4 questions for this (not only 1), just tell me how can I pay the other 3. nterface Order +make Order): string +make Payment (double amount): string Contact +contactID: integer name:string +address: string +phoneNum :string +Contact(int id, string name, st ring address, string phoneNum) +To String): string Customer Vendor +Customer (int id, st ring name, string address, string phoneNum) A +Vendor int id, string name, string address, string phoneNum)...

  • Write a program that implements a rudimentary name-finder. It should start out by filling up a...

    Write a program that implements a rudimentary name-finder. It should start out by filling up a name ArrayList with Name objects. Then it should ask the user if he/she wants to find a particular name. Then it should search for the name in the name ArrayList and return the names information if the name is found. Here is a suggested UML class diagram: Implement Name filltheblackbook method by adding anonymous objects representing these four names: First Name                       Last Name               Address...

  • I NEED THE ANSWER IN C++ FORMAT I need the answer In C++ format Your question...

    I NEED THE ANSWER IN C++ FORMAT I need the answer In C++ format Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Suppose a string variable fullName contains last name of a Suppose a string variable fullName contains last name of a person, followed by a comma, space, and first name Write to the screen a line containing a greeting "Hello <firstName>!", where sfirstName> is the first name taken from...

  • Must be in Java. Please show step by step process with proper explanation and comments. Please...

    Must be in Java. Please show step by step process with proper explanation and comments. Please maintain proper indentation. CODE PROVIDED: Doctor.java HospitalDoctor.java Q1Runner.java import java.util.Scanner; public class Q1Runner { public static void main(String[] args) { Scanner kb = new Scanner(System.in);               // Do your work here        } } You are asked to create the starting point of a system to represent several types of medical doctors. You decided to implement two classes: a superclass...

  • 0.Use Factory Design Method 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY...

    0.Use Factory Design Method 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY = 6000.00 STAFF_MONTHLY_HOURS_WORKED = 160 2. Implement an abstract class Employee with the following requirements: Attributes last name (String) first name (String) ID number (String) Sex - M or F Birth date - Use the Calendar Java class to create a date object Default argument constructor and argument constructors. Public methods toString - returning a string with the following format: ID Employee number :_________...

  • you must implement public class Student by following the instructions as follows exactly. You may reference...

    you must implement public class Student by following the instructions as follows exactly. You may reference Chapter 7 for the similar examples to get the ideas and concepts. Each student must have the following 5 attributes (i.e., instance variables): private String   studentID ;              // student’s ID such as                         1 private String lastName   ;                         // student’s last name such as              Doe private String firstName ;             // student’s first name such as            John private double gpa...

  • This assignment was locked Mar 24 at 11:59pm. For this lab you will implement a phone...

    This assignment was locked Mar 24 at 11:59pm. For this lab you will implement a phone book using a linked list to keep people's names and phone numbers organized in alphabetical order. 1. Define a structure to hold the contact information including: name, phone number, a pointer to the next node in the list. Example: struct ContactNode { string name; string phoneNumber; ContactNode *next; } 2. Define a class containing the structure and the appropriate methods to update and retrieve...

  • JAVA help Create a class Individual, which has: Instance variables for name and phone number of...

    JAVA help Create a class Individual, which has: Instance variables for name and phone number of individual. Add required constructors, accessor, mutator, toString() , and equals method. Use array to implement a simple phone book , by making an array of objects that stores the name and corresponding phone number. The program should allow searching in phone book for a record based on name, and displaying the record if the record is found. An appropriate message should be displayed if...

  • Complete the Person class: For setEmail, setFirstName, and setSurname: if the method is passed an empty...

    Complete the Person class: For setEmail, setFirstName, and setSurname: if the method is passed an empty string, it should do nothing; but otherwise it should set the appropriate field. For setMobile: if the method is passed a valid mobile phone number, it should set the appropriate field; otherwise it should do nothing. A string is a valid mobile phone number if every character in it is a digit from 0 to 9. Hints: To convert a string so you can...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT