0% found this document useful (0 votes)
6 views2 pages

Java Addition for Non-Negative Integers

The document outlines the creation of a Java application for adding two non-decimal numbers, specifying the class structure and method requirements. The method must handle specific conditions for negative and zero inputs, returning designated error codes. Additionally, it includes guidelines for testing and pushing the code to a remote repository, emphasizing the importance of unit tests and branch management.

Uploaded by

arvind
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Java Addition for Non-Negative Integers

The document outlines the creation of a Java application for adding two non-decimal numbers, specifying the class structure and method requirements. The method must handle specific conditions for negative and zero inputs, returning designated error codes. Additionally, it includes guidelines for testing and pushing the code to a remote repository, emphasizing the importance of unit tests and branch management.

Uploaded by

arvind
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Create a java application for the below-mentioned task by following the below-

mentioned guidelines.

Task:
Perform addition operation on two non-decimal numbers.

Task Guidelines:
1. Define a class named TwoNonDecimalNumbersAddition.
2. Define a method named add in the above-mentioned class for performing the task.
3. The above-mentioned method must:
a) perform the task and return the result as a number whose range exceeds
2,147,483,647.
b) contain two parameters of number type with a range from 0 to
2,147,483,647.
c) return -1 if a negative number is passed to any parameter.
d) return -2 if 0 value is passed to any parameter.

General Guidelines:
1. To check the functionality of the code for the task, create a program class to
execute your code.
2. Once finished with checking the functionality, run unit tests on your code for
the task to verify if you have completed the task as per the guidelines.
3. After your code for the task passes all the unit tests, push it back to the
remote repository from where you have cloned the application.
4. Do remember to push your code for the task to the branch with your name and not
the main branch.
5. The code for the task is considered for evaluation and not the code in program
class.
6. You can use print statements for your reference while writing the code for the
task but do remember to remove them (except from program class) before submitting
the code.
7. Sample inputs and expected output is given below for your reference to check the
functionality of the code for the task.

Sample Inputs 1:
10 & 2
Expected Output 1:
12

Sample Inputs 2:
2 & 10
Expected Output 2:
12

Sample Inputs 3:
10 & -2
Expected Output 3:
-1

Sample Inputs 4:
-10 & 2
Expected Output 4:
-1

Sample Inputs 5:
-10 & -2
Expected Output 5:
-1
Sample Inputs 6:
10 & 0
Expected Output 6:
-2

Sample Inputs 7:
0 & 2
Expected Output 7:
-2

Sample Inputs 8:
0 & 0
Expected Output 8:
-2

You might also like