Question: C# program Constructor overloading Create a class ProblemSolution with following characteristics First constructor accepts two integer parameters N1 and N2 and displays addition of 2
C# program
Constructor overloading
Create a class ProblemSolution with following characteristics
First constructor accepts two integer parameters N1 and N2 and displays addition of 2 numbers.
Second constructor accepts three integer parameters N1, N2 and N3 and displays addition of 3 numbers.
Input 10 20 45
where
First line represents a value of N1.
Second line represents a value of N2.
Thrid line represents a value N3.
Output 30 75
PLEASE FILL IN THE PARTIAL CODE BELOW
using System; using System.Collections.Generic; using System.Linq; public class ProblemSolution {
//write your code here
} class DriverMain {
public static void Main () { int N1 = int.Parse (Console.ReadLine ()); int N2 = int.Parse (Console.ReadLine ()); int N3 = int.Parse (Console.ReadLine ()); ProblemSolution problemsolution1 = new ProblemSolution (N1, N2); ProblemSolution problemsolution2 = new ProblemSolution (N1, N2, N3); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
