IME Department, IIT Kanpur
IME 603, Introduction to Computing, I Sem, 2020-21
Assignment 2
Due: 11PM, 18 Sep 2020
Credit: 3% of the course
Write a class MyCheck that has the following methods.
1. A method isMultiple that takes two long values n and m and returns true if n is a multiple
of m,(that is n = m * i for some integer i).
2. A method isOdd that takes an int n and returns true if n is odd. Your method cannot use
the multiplication, modulus or division operator.
3. A method allSum that takes an integer n and returns the sum of all positive integers less
than or equal to n.
4. A method allESum that takes an integer n and returns the sum of all the even positive
integers less than or equal to n
5. A method allSqSum that takes an integer n and returns the sum of the squares of all
positive integers less than or equal to n.
Write another class containing main method that will first ask user to make a choice of the
method and then take appropriate number of inputs and display results.