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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!