0% found this document useful (0 votes)
45 views1 page

Assignment 2 Due: 11PM, 18 Sep 2020 Credit: 3% of The Course

The document outlines an assignment for IME 603, Introduction to Computing, at IIT Kanpur, due on September 18, 2020, worth 3% of the course grade. It requires the creation of a class 'MyCheck' with specific methods to check multiples, determine odd numbers, and calculate various sums. Additionally, a main class is needed to interact with the user for method selection and input handling.

Uploaded by

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

Assignment 2 Due: 11PM, 18 Sep 2020 Credit: 3% of The Course

The document outlines an assignment for IME 603, Introduction to Computing, at IIT Kanpur, due on September 18, 2020, worth 3% of the course grade. It requires the creation of a class 'MyCheck' with specific methods to check multiples, determine odd numbers, and calculate various sums. Additionally, a main class is needed to interact with the user for method selection and input handling.

Uploaded by

Sumit Tripathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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.

You might also like