Java_Exercises (1)
Java_Exercises (1)
2. Write a function that takes a parameter n, if n is even, returns true, if it is odd, returns false.
3. Write a function that takes a positive integer and returns the reverse of the number passed.
For example, pass in the function a number 12345, returns 54321. (Do not print out the
screen in the function)
4. Write a program to calculate bank interest that allows the user to enter the deposit amount
and the number of months wants to deposit. Calculate the amount the customer is
expected to receive based on the following formula:
The amount received = Deposit amount + Deposit amount * Interest rate
Number of months Interest rate
Number of months <= 3 months 1%
Number of months <= 6 months 1.5%
Number of months < 12 months 3%
Number of months = 12 months 5%
The program only allows users to enter a positive integer that <= 12. In case of incorrect
input, notify the user and allow re-entry.
5. Write a function that takes the parameter n, using loops to print the following figures to
the screen according to the value of n passed:
n=3
*
***
*
n= 5
*
***
*****
***
*
n= 7
*
***
*****
*******
*****
***
*