Question
1. Write a Java program (Ex1.java) to remove a specific element from an array of integers. Example: [1, 2, 3, 4, 5] Input: 3 Output:
1. Write a Java program (Ex1.java) to remove a specific element from an array of integers.
Example: [1, 2, 3, 4, 5]
Input: 3
Output: [1, 2, 3, 5] or [1, 2, 3, 5, 5]
2. Write a Java program (Ex2.java) to insert an element (specific position) into an array of integers.
Example: [1, 2, 3, 4, 5]
Input: 3, 9
Output: [1, 2, 3, 9, 4, 5] or [1, 2, 3, 9, 4]
3. Write a Java program (Ex3.java) to reverse an array of integer values.
Example: [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
4. Write a Java program (Ex4.java) to find the common elements between two arrays of integers.
Example: [1, 2, 3, 4, 5] and [3, 4, 5, 6, 7]
Output: [3, 4, 5]
5. Write a Java program (Ex5.java) to remove duplicate elements from an array.
Example: [1, 1, 3, 4, 5]
Output: [1, 3, 4, 5]
Example: [8, 8, 2, 4, 2]
Output: [2, 4, 8]
6. Write a Java program (Ex6.java) to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Example: [0, 1, 0, 12, 3]
Output: [1, 12, 3, 0, 0]
7. Write a Java program (Ex7.java) to decide if two strings are anagrams or not. (Two strings are anagram if they can be the same after change the order of characters)
Example:
Given s = "abcd", t = "dcab", output - they are anagrams.
Given s = "listen", t = "silent", output - they are anagrams.
Given s = "ab", t = "ac", output - they are not anagrams.
8. Write a program (Ex8.java) to play the game of "Guessing Number III". The game has four LEVELS -
LEVEL I - use Random generator to generate a number (0-5), then let the player input a guess. If theplayer's input is correct, move to the next stage.
LEVEL II - use Random generator to generate a number (0-9), then let the player input a guess. If theplayer's input is correct, move to the next stage.
LEVEL III - use Random generator to generate a number (0-15), then let the player input a guess. If theplayer's input is correct, move to the next stage.
LEVEL IV - use Random generator to generate a number (0-19), then let the player input a guess. If theplayer's input is correct, the user wins.
Note that - The user has at most three chances per LEVEL! Print the current level and how many chances left before the player inputs the guess.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started