Question
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
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