Home /
Expert Answers /
Computer Science /
using-codezinger-java-static-polymorphism-given-three-integer-numbers-n1-n2-and-n3-write-2-over-pa286
(Solved): Using codezinger- java
Static Polymorphism Given three integer numbers N1, N2 and N3. Write 2 over ...
Using codezinger- java
Static Polymorphism Given three integer numbers N1, N2 and N3. Write 2 overloaded functions which perform addition of passed values. Write two functions inside 'ProblemSolution' class: Function 1: solution that accepts two parameters, N1 and N2. A function should return addition of those numbers. Function 2: solution that accepts three parameters, N1, N2 and N3. A function should return addition of 3 numbers. Where, - The first line of output contains addition of N1 and N2. - The second line of output contains addition of N1, N2 and N3.
DriverMain.java \( \mathbf{x} \) 1 . import java.util.*; 2 3 - public class Drivermain \{ 4. public static void main(String[] args) \( f \) 5 Scanner \( s= \) new Scanner(System, in); 6 int \( \mathrm{N} 1=5 . \) nextInt(); \( 7 \quad \) int \( \mathrm{N} 2= \) s. nextint ()\( ; \) \( 8 \quad \) int \( \mathrm{N} 3=5 \), nextInt( \( ) ; \) 9 Problemsolution problemSolution = new ProblemSolution(); 10 System.out.println(problemSolution. Solution(N1, N2)); 11 System, out.print(problemSolution, solution(N1, N2, N3)); \( 12\} \) \( 13\} \)