010-001-005

Method Overloading: Calculator Class

Hard

Problem Description

method overloading: Calculator class

In this problem, you will create a program that overloads an add method with three different parameter patterns (int+int, int+int+int, double+double) and displays each addition result to standard output.

Learning Objective: Implement overloading to distinguish same-named methods by parameter type or count

Create a calculator class. Define multiple add methods to implement addition based on parameter count and type.

Input

Line 1: Integer a (int)
Line 2: Integer b (int)
Line 3: Decimal c (double)

Output

int + int = [result]
int + int + int = [result]
double + double = [result]

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up