Computers and Technology
07.05.2022 21:21
245
476
7
Solved by an expert

Create a function called sayMyName . It will take one parameter. Call this parameter

Create a function called 'sayMyName'. It will take one parameter. Call this parameter 'myName'. Return the phrase "Hello, my name is " and the myName parameter.
Ex: If name is 'Dan' it should return the string:
'Hello, my name is Dan'.
Show Answers
22norvd
22norvd
4,9(53 marks)

   public static String sayMyName(String myName){

       return "Hello, my name is "+myName;

   }

Explanation:

Using Java programming language

The method (function) sayMyName () is created to accept a String variable as a parameter and return a string which has the phrase Hello, my name is concatenated with the argument passed to it

See below a complete program with a main that prompts a user for a name, calls sayMyName and passes the name entered by the user as an argument

import java.util.Scanner;

public class num3 {

   public static String sayMyName(String myName){

       return "Hello, my name is "+myName;

   }

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Please enter your name");

       String name = in.nextLine();

       System.out.println(sayMyName(name));

   }

}

lacyfigueroa
lacyfigueroa
4,4(95 marks)

If this is actually college then thats weird cuz im in middle school and im doing this stuff. And the answer is wireless networks

Explanation:

Popular Questions about the subject: Computers and Technology

What are other ways you could use the shake or compass code blocks in physical...
Computers and Technology
10.12.2022 22:31
Where do today s computers store almost all motherboard configuration data?...
Computers and Technology
02.03.2020 19:48
You are a desk support technician at a retail department store and you receive...
Computers and Technology
18.06.2021 08:20
Aquadratic equation is an equation of the form ax2+bx+c. a, b, and c are the...
Computers and Technology
10.10.2022 13:17
Three business partners are forming a company whose name will be of the form...
Computers and Technology
06.01.2020 22:01
The following code does not work as intended. it is meant to input two test...
Computers and Technology
25.03.2020 00:47
Need right now what is the role of the cpu of a computer?...
Computers and Technology
10.03.2023 04:23
What can you do to stop a computer from repeatedly restarting in a continuous...
Computers and Technology
18.02.2023 23:01
A(n) is an external device that attaches to a mobile computer or device, which...
Computers and Technology
16.02.2023 00:54
True or false? main content (mc) may include links on the page....
Computers and Technology
08.07.2020 03:53

New questions by subject

What are the names of the 3 layers of earth...
Biology
22.11.2022 19:45
Determine which of the following is a possible length for ac...
Mathematics
14.02.2021 21:31
Ophelia s funeral rites were brief. true or false...
English
30.12.2021 11:37
While making oatmeal cookies, angela needs to add 1/2 cup of milk to her dough....
Mathematics
03.07.2022 07:00
Write the nunber 0.035 as a percent 3.5% 0.35% 35% 0.035%...
Mathematics
25.11.2022 03:10
Who does romeo act as a character foil for...
English
20.06.2023 15:36
Use the graph below to answer the question that follows: trig graph with points...
Mathematics
05.03.2022 02:54
#
#
#
#
# #

We expand our knowledge with many expert answers