Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part III:Problem Solving Questions [40 Marks] Note: Provide a copy of the code a

ID: 3772109 • Letter: P

Question

Part III:Problem Solving Questions                                  [40 Marks]

Note: Provide a copy of the code and screen shot for the output in the solutions’

1-Write a program to create two multidimensional arrays of same size. Accept value from user and store them in first array. Now copy all the elements of first array into second array and print second array

2-Write a C# application that asks the user to input the required data to implement thefour methods below:

(Use Method Overloading to write the methods)

Method Area that take as input an int value ‘side’, calculates the area of a square, and displays it.

Method Area that take as input an int value ‘L’ and an int value ‘B’, calculates the area of a rectangle, and displays it.

Method Area that takes as input a double value ‘R’, calculates the area of a circle, and displays it.

Method Area that take as input a double value ‘B’, and a double value ‘H’, calculates the area of a triangle, and displays it.

3-Write a C# application that asks the user to input a month and prints the number of days in the month. Use Switch statement.

Enter array value: nter array value Enter array value: Enter array value: Enter array value Enter array value Enter array value: nter array value: Enter array value: 8 2 6 9 3 6 Elements of second array are: 7 6 8 6

Explanation / Answer

Answer for question #1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Triangle
{
    class MultiDimensionalArray
    {
        static void Main(string[] args)
        {

        
            int[,] array1 = new int[3,3];
            int[,] array2 = new int[3,3];

            string str ="";
        
            for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
            {
                Console.WriteLine("Enter integer: ");
                str = Console.ReadLine();
                array1[i, j] = Int32.Parse(str);
   
            }

          
            //copy array1 to array 2
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
            {
                array2[i, j] = array1[i, j];
            }

            Console.WriteLine("Elements of second array are: ");
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Console.Write(array1[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}

---output--------------

Enter integer:
1
Enter integer:
8
Enter integer:
7
Enter integer:
6
Enter integer:
4
Enter integer:
9
Enter integer:
3
Enter integer:
8
Enter integer:
6
Elements of second array are:
1 8 7
6 4 9
3 8 6