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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started