1. Create a console application.
2. Add a public class called compute_product.
3. In compute_product declare two private fields (class variables) named value1 and value2.
4. For field (class variable) value2 create a public property named Value2 and implement the get and set.
5. Add a constructor to assign a value to the value1 field by passing an integer value to the constructor when the constructor is instantiated in Main.
6. Add a method named public void display_product_calc() and use a Console.WriteLine to display the result of multiplying value1* Value2 to the console.
7. In Main declare a variable named myValue1 and assign the value 5 to it.
8. In Main instantiate a compute_product object named myproduct and pass myValue1 in the constructor parameter list.
9. In Main use the Value2 class property to set the value of class variable value2 to integer 10.
10. Call the compute_product class display_product_calc method from Main; the displayed result will be 50.
The output would look like this:
The product is 50
Press any key to continue . . .
What I have tried:
static void Main()
compute_product cp=new compute_product();
Console.WriteLine("The product of two numbers is:\n" display);
public class compute_product
private int val1;
private int val2;
public int val2
val2 = 10;
public void display_product_calc()
result = (val1 * val2);