


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A programming assignment from the cs and it dept of superior university. The assignment involves writing and testing various static methods in java, including methods to calculate the area of a circle, find the smallest integer, raise a number to a power, determine if a number is a square, compute the cube of a number, get the kth digit of a number, calculate the factorial of a number, sum the elements of an array, reverse a string, reverse an integer, determine if a number is prime, return the nth fibonacci number, print numbers between given ranges, print even numbers between given ranges, print odd numbers between given ranges, and find the remainder of a division. The assignment is intended for university students studying computer science and it.
Typology: Exercises
1 / 4
This page cannot be seen from the preview
Don't miss anything!



6. Write and test the following static method that determines whether the given integer is a square number: static boolean isSquare(int n) ( Note: The first ten square numbers are 1,4,9,16,25,36,49,64,81 and 100. ) 7. Write and test the following static method that computes the cube of a given integer: static long cube( int n)
17. Write and test the following static method using recursion that would print the series of ODD numbers between the given ranges (start and end). NOTE: Don’t use any loop syntax. static void printOdd( int start,int end ) 18. For some reason, the computer you're working on doesn't allow you to use the modulo operator % to compute the remainder of a division. Write and test the following static method using recursion that would return the remainder. For example the following call remainder (14, 3) would return 2 (14%3=2). static void remainder( int numerator ,int denominator )
-------------------------------------------