Wk10_Methods - B - Programming I Practice using the out and...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming I Practice using the out and ref modifiers You need to do all the questions in a single project. You will invoke the methods from your main 1. Write a method that takes four arguments. The first two arguments are ints, the third is a char and the last is an int. The first argument represents two ints that will be operands for an arithmetic operation, the third argument represents the arithmetic operation to be performed on the first two numbers and the last argument represent the result of the computation. The method must be coded so that the result of the calculation is available to the calling method i.e the fourth argument must be decorated so that its value is available to the calling method From your main, call this method twice with different arithmetic operators and display the result in a simple readable format [Hint: the following code statements in main will call the method int a = 10, b = 5, result; char operation = '+' Method(a, b, operation, out result); Console .WriteLine("{0} {2} {1} = {3}", a, b, operation, result);
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern