codingprolab@gmail.com

$30.00

Order Now
Category: WIX 1002

Description

5/5 - (4 votes)

1. Write a Java method that returns a triangular number. A triangular number is defined

as 1+2+3+…+ n. Then, write a Java program to use the method to display the first 20

triangular numbers.

2. Write a Java method multiPrint(int n, char c) that prints n copies of character c. Then,

write a Java program to use the method to display the triangles and diamonds.

3. Write a Java method that accepts an array of 10 integers. The method should reverse

the integer in the array. Example, if the number is 1234, the number will change to

4321.

4. Write a Java method that implements Euclidean Algorithm to return the greatest

common divisor of two positive integers. Then, write a program to get the GCD for

(24, 8) and (200, 625).

5. Write a Java method that accepts three parameters, the method will compare whether

the third parameter value is equal to the multiplication of parameter 1 and parameter

2. Then, write a Java multiplication game for any random number within 0 – 12.

Example Output:

6. Write a Java method that determine whether a number is a palindromic prime and

another method that determine whether a number is emirp (the number is a prime

number and the reverse also a prime number and is not palindromic prime). Then,

write a Java program to use the methods to display the first 20 palindromic prime and

emirp.

WhatsApp us