Question: Use C# to slove this Program Overview This exercise is meant to give you practice in writing methods. The methods themselves are fairly simple because
Use C# to slove this
Program Overview This exercise is meant to give you practice in writing methods. The methods themselves are fairly simple because the intent of the exercise is to build in lots of repetitive exposure to the structure of methods: syntax, header, arguments, returning values, etc. A method is only executed when it is called or invoked. Thus, all methods will then be called from the Main method to test whether the method works. As you are working through the exercise, you may want to first write one method, then scroll down to the Main method, which lists how to test the method and do the segment to test the method. Then scroll back and write the next method and test it. If you write and test methods as a pair as you work your way through the exercise, youll catch errors while writing a method and be able not to repeat the error again.
1) Method Name: PrintGreeting Access modifier: Private Parameters: none Return type: void Purpose: This method prints out Hello to the Console In the body of the method block, Use a WriteLine statement to print the word Hello to the Console
2) Method Name: Product Access modifier: Private Parameters: 2 integers, number1 and number2. Return type: integer Purpose: This method returns the product of two integers In the body of the method block, Return the product of the two parameters. Use the return keyword!
3) Method Name: Concatenate Access modifier: Private Parameters: 2 strings, string1 and string2 Return type: string Purpose: This method joins two strings In the body of the method block, Return the two strings joined together. You can join the two strings using string concatenation, i.e. using the plus (+) operator or you can use the string interpolation syntax (with the $ sign).
4) Method Name: Divide Access modifier: Private Parameters: 2 integers, number1 and number2. Return type: double Purpose: This method returns the quotient after dividing two numbers. In the body of the method block, Declare a double called quotient. Initialize it with a value of 0.0. Divide number1 by number2. When you are dividing the two numbers, cast number1 as a double i.e. force it to be used as a double, by preceding it with the cast operator, i.e. (double) (no quotes needed). Assign the resulting value to the variable, quotient. Return quotient.
5) Method Name: ArrayContains Access modifier: Private Parameters: integer, number Return type: boolean Purpose: This method returns a true or a false indicating if the number is present in an array or not.
Ouput should look like that

Sample Output file:///G:/CIS 340 Fall 2016/Inclass/IC8-Methods/Methods/bin/Debug/Methods.EXE Hello Testing Product and retur alues he product of 5 and 2 is 10 Testing Concatenate and nested nethod calls The return value is "HelloWorld" Testing Array Search esting if the nunber 4 is present in the array.... Array contains the number 4 Testing if the nunber 50 is present in the array... rray does not contains the nunber 50 Testing Divide and return values The result of dividing ? by 6 is 1.1667
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
