21.1k views
4 votes
Write a function called show_info that takes a name, a home city, and a home state (a total of 3 arguments) and returns a full sentence string with the following content and format: Your name is [name] and you live in [city], [state].

User Chhameed
by
8.1k points

1 Answer

3 votes

Answer:

Below are the function for the above question in java Language---

void show_info(String name,String home,String state)

{

System.out.println("Your name is "+name+" and you live in "+ home+" ,"+state +".");

}

Output:

  • If the user inputs name="Gaus",city="LosAngeles" and state="California" then the output will be "Your name is Gaus and you live in LosAngeless, California."

Step-by-step explanation:

  • The above function is in java language which takes three argument names, state, and the city.
  • The name will be stored on the name variable of the string type.
  • The state will be stored on the state variable of string type.
  • The city will be stored on the city variable of the string type.
  • Then the Output will be displayed with the help of the print function.
  • '+' is used to merge the string.
User Diego Vieira
by
8.6k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.