Question: C# programing Single inheritance-Part 2 Given two integer numbers N1 and N2, create a class 'ProblemSolution' with following characteristics. Must extend a 'Base' class. Create

C# programing

Single inheritance-Part 2

Given two integer numbers N1 and N2, create a class 'ProblemSolution' with following characteristics.

Must extend a 'Base' class.

Create a method 'solution' with two integer parameters (N1 and N2) and long return type.

The 'solution' method should call the addition and subtraction methods of 'Base' class and return multiplication of returned results of addition and subtraction method.

Result = (N1 + N2) * (N1 - N2)

What is inheritance? Inheritance is a mechanism in which one object acquires all the properties and behaviors of the parent object. Reference: https://www.javatpoint.com/c-sharp-inheritance

Input 50 10

Output 2400

Please fill in the partial code below

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

//write your code here

public class Base { public int addition (int N1, int N2) { int Z = N1 + N2; return Z; }

public int subtraction (int N1, int N2) { int Z = N1 - N2; return Z; } }

class DriverMain {

public static void Main () { int N1 = int.Parse (Console.ReadLine ()); int N2 = int.Parse (Console.ReadLine ()); ProblemSolution problemsolution = new ProblemSolution (); Console.WriteLine(problemsolution.solution (N1, N2)); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!