Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago