FUNCTIONS

28 programming challenges to help you master the fundamentals of CORE JAVA PROGRAMMING.

1

Write a Java method to find the smallest number among three numbers.

2

Write a Java method to compute the average of three numbers.

3

Write a Java method to display the middle character of a string. Note: a) If the length of the string is odd there will be two middle characters. b) If the length of the string is even there will be one middle character.

4

Write a Java method to count all the words in a string.

5

Write a Java method to compute the future investment value at a given interest rate for a specified number of years.

6

Write a Java method to print characters between two characters (i.e. A to P).

7

Write a Java method to check whether a string is a valid password.

8

Write a Java method to display the current date and time.

9

Write a Java method to find all twin prime numbers less than 100.

10

Write a Java method to count the number of digits in an integer with the value 2. The integer may be assumed to be non-negative.

11

Write a Java method that accepts three integers and checks whether they are consecutive or not. Returns true or false.

12

Write a Java method that accepts three integers and returns true if one is the middle point between the other two integers, otherwise false

13

Write a Java method that checks whether all the characters in a given string are vowels (a, e,i,o,u) or not. Return true if each character in the string is a vowel, otherwise return false.

14

Write a C++ method to find the smallest number among three numbers.

15

Write a C++ method to compute the average of three numbers.

16

Write a C++ method to display the middle character of a string.

17

Write a C++ method to find all twin prime numbers less than 100.

18

Write a C++ method to count the number of digits in an integer with the value 2. The integer may be assumed to be non-negative.

19

Write a C++ method that accepts three integers and checks whether they are consecutive or not. Returns true or false.

20

Write a C++ method that checks whether all the characters in a given string are vowels (a,e,i,o,u) or not. Return true if each character in the string is a vowel, otherwise return false.

21

Write a program to enter 2 number from the users add them and display the answer, again enter 2 number from the user subtract them and display the answer, again enter 2 number from the user add them and display the answer, again enter 2 number from the user multiply them and display the answer, again enter 2 number from the user subtract them and display the answer, again enter 2 number from the user multiply them and display the answer, again enter 2 number from the user divide them and display the answer, again enter 2 number from the user divide them and display the answer, again enter 2 number from the user add them and display the answer ?

22

Write a program to enter 10 number from the user add the number and display the answer ?

23

Write a program to return an array from function ?

24

Making following program using local and global variable ? Factorial , Reverse , Palindrome , Prime numbers, Armstrong , Fibonacci

25

Swap numbers using Call by address ?

26

Swap numbers using Call by function ?

27

Make function for find out power of number, enter the number and power from user ?

28

Make function for find out Cube a user entered number ?