0% found this document useful (0 votes)
25 views

Core Java Assignment 2

The document describes how to design a simple calculator in Java with methods for addition, subtraction, multiplication, division, remainder, and square root. It provides the method signatures and parameters for each functionality.

Uploaded by

Priya Shetty
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Core Java Assignment 2

The document describes how to design a simple calculator in Java with methods for addition, subtraction, multiplication, division, remainder, and square root. It provides the method signatures and parameters for each functionality.

Uploaded by

Priya Shetty
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Design a Simple Calculator using methods in Java containing the following

functionalities, namely, with Addition, Subtraction, Multiplication, Remainder, Division


and Square Root. The signature of the methods are given below.

 ⇒ public static int additionSimple(int x, int y)


o     ℴ two inputs, x and y. Return the result of adding x to y.
 ⇒ public static int subtractionSimple(int x, int y)
o     ℴ two inputs, x and y. Return the result of subtracting x from y i.e y-x.
 ⇒ public static int multiplicationSimple(int x, int y)
o     ℴ two inputs, x and y. Return the result of multiplying x to y i.e. x*y.
 ⇒ public static double divisionSimple(int x, int y)
o     ℴ two inputs, x and y. Return the result of dividing y by x. Please check
whether x is zero before dividing.
 ⇒ public static int remainderSimple(int n, int m)
o     ℴ Please make sure that remainderSimple() takes two inputs, namely, a
number (int) n and a number (int) m. the method should return the
remainder of n divided by m.
 ⇒ public static double squareRootSimple(int n)
o     ℴ Takes one input, namely a number n, and returns the square root of
the number. The return should be double. Please kindly make sure that the
number n is positive.

You might also like