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
You should check your battery ___________. Every week Never Every six months Every 30,00 miles
vova2212 [387]

The answer is Every six months

A battery acts as the brain of a car and is used to power almost everything. It can last up to five years. However, this lifespan will depend on how well the battery is maintained and the type of weather conditions you live in. Aim to check your car battery at least twice a year. Actually, it is best to check your battery regularly and not to wait for your mechanic to test your battery during routine servicing.

5 0
3 years ago
Read 2 more answers
____ map a set of alphanumeric characters and special symbols to a sequence of numeric values that a computer can process.
Neporo4naja [7]
The answer is : coding schemes
4 0
3 years ago
Write the definition of a void function that takes as input an integer and outputs two times the number if it is even; otherwise
KatRina [158]

Answer:

Written in C++

void number(int n){

if(n%2 == 0)

cout<<2 * n;

else

cout<<5 * n;

}

Explanation:

The programming language is not stated.

However, I answered using C++

This line defines the function as void

void number(int n){

This line checks if the number is even

if(n%2 == 0)

If yes, it doubles the number and prints the output

cout<<2 * n;

If otherwise,

else

It multiplies the number by 5 and prints the output

cout<<5 * n;

}

To call the function from main, use:

number(n);

Note than n must be declared as integer

See attachment

Download cpp
6 0
2 years ago
Which of the following would be considered a subtopic for a mind map?
Grace [21]

Answer:

C) Plants

Explanation:

"Ecosystem" is the topic. Then "Plants" is the sub topic. Next the "Number of trees" and "Number of shrubs" branch out from there (Pun intended (; ).

4 0
2 years ago
Jackson is teaching a class the concept of the binary number system. Which term will he use to refer to the leftmost bit of a bi
Fofino [41]
Most significant digit. That's the same that it's called for any number system.
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is wrong, logically, with the following code? if (x &gt; 10) System.out.println("Large"); else if (x &gt; 6 &amp;&amp; x &l
    11·1 answer
  • List and explain the error in the code
    14·1 answer
  • A _____ is a harmful program that resides in the active memory of a computer and duplicates itself. Select one: a. scareware b.
    7·1 answer
  • What are html documents also called?
    12·1 answer
  • Omo help me i need it now.
    12·1 answer
  • To solve the difficulty of scaling memory organization, memories are physically organized into a ____-dimensional organization.
    9·1 answer
  • You are considering using Wi-Fi triangulation to track the location of wireless devices within your organization. However, you h
    9·1 answer
  • Which of the following formats can algorithms NOT be written in:
    8·2 answers
  • Im a beginner programmer. what languages should i learn and how do i get better
    13·1 answer
  • Which backup requires a small amount of space and is considered to have an involved restoration process?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!