1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Illusion [34]
3 years ago
13

Write a method named lastFirst that accepts a string as its parameter representing a person's first and last name. The method sh

ould return the person's last name followed by the first initial and a period. For example, the call lastFirst("Marla Singer") should return "Singer, M." . You may assume that the string passed consists of exactly two words separated by a single space.
Computers and Technology
1 answer:
Usimov [2.4K]3 years ago
7 0

I'm going to assume this is Java, because you said "method" meaning it will be some sort of object oriented language, and Java's really common. Here would be the full program, but you can just take the method out isolated if you need it.

package lastname;

public class LastName {

   public static void main(String[] args) {

       // Example usage:

       String name = LastName.lastName("Garrett Acord");

       System.out.println(name);

       // Output: Acord G.

   }

   public static String lastName(String fullName)

   {

       String[] splitName = fullName.split(" ");

       return String.format("%s %s.", splitName[1], splitName[0].substring(0,1) );

       

   }

   

}

You might be interested in
Unlike a virtual image, a real image
IRINA_888 [86]
C.cannot be viewed on a screen
4 0
3 years ago
You want to securely erase data from your hard drive what can you use to do this and what is the process called
tankabanditka [31]
You could Factory Reset a computer or you could smash it with  a hammer
7 0
3 years ago
Read 2 more answers
Riodic Table
Ksenya-84 [330]

Answer:

riodic Table

A museum wants to store their valuable documents in cases that contain a gas that will protect the documents.

She should not choose one of the other gases because they are too

The museum director should choose

Explanation:

I didn't understand

8 0
3 years ago
Write the contributions of dr herman hollerith​
Ad libitum [116K]

He invented the tabulating machine. In 1890 U.S

5 0
3 years ago
My HTC Desire 510's mobile data stopped working, how to I make it work again?
denis-greek [22]
Ask your mobile operator
2.go to hrs service
3. Turn on and turn off
4 0
3 years ago
Other questions:
  • In a social networking site your personal information is listed under your inbox. home. status. profile.
    11·1 answer
  • You bought a monochrome laser printer two years ago. The printer has gradually stopped feeding paper. Which printer component sh
    14·1 answer
  • The ________ of the operating system enables users to communicate with the computer system. modem window network adapter card us
    14·1 answer
  • George, a user, has contacted you to complain that his issue has not been resolved. He has already contacted your department twi
    9·1 answer
  • How to buy free big money computers that earn free money everydays?
    15·1 answer
  • A film camera with only one lens is known as a(n)?
    11·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    5·1 answer
  • Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSi
    6·1 answer
  • The internet in this Packet Tracer network is overly simplified and does not represent the structure and form of the real intern
    11·1 answer
  • List and explain three ways study groups benefit your learning.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!