Advance Csharp – Homework: Methods (Solution)

$ 29.99
Category:

Description

Problem 1. Bigger Number
Write a method GetMax() with two parameters that returns the larger of two integers. Write a program that reads 2 integers from the console and prints the largest of them using the method GetMax().
Sample Code Input Output
4
-5 4
Problem 2. Last Digit of Number
Write a method that returns the last digit of a given integer as an English word. Test the method with different input values. Ensure you name the method properly.
Sample Code Output
two four nine
Problem 3. Larger Than Neighbours
Write a method that checks if the element at given position in a given array of integers is larger than its two neighbours (when such exist).
Sample Code Output
False
False
False True
False
False True

Problem 4. First Larger Than Neighbours
Write a method that returns the index of the first element in array that is larger than its neighbours, or -1 if there’s no such element. Use the method from the previous exercise in order to re.
Sample Code Output
3
-1
-1
Problem 5. Reverse Number
Write a method that reverses the digits of a given floating-point number.
Sample Code Input Output
256
123.45
0.12 652
54.321
21
Problem 6. Number Calculations
Write methods to calculate the minimum, maximum, average, sum and product of a given set of numbers. Overload the methods to work with numbers of type double and decimal.
Note: Do not use LINQ.
Problem 7. * Generic Array Sort
Use a generic method (read in Internet about generic methods in C#). Make sure that what you’re trying to sort can be sorted – your method should work with numbers, strings, dates, etc., but not necessarily with custom classes like Student.
Sample Code

Reviews

There are no reviews yet.

Be the first to review “Advance Csharp – Homework: Methods (Solution)”

Your email address will not be published. Required fields are marked *