Java Practice Assignment #4 – The Anagram

by Trevor Page on January 17, 2013

Alright ladies and gentlemen, this week’s assignment is in. But before we get into it:

Click Here to download my particular solution for Assignment 3.

There will be many ways to solve this assignment, and I’m not saying that my solution is the best solution, but if you were having trouble getting your assignment to work, then mine might help you out. If you feel like you’ve got a better solution feel free to shoot it over to me via email at info@howtoprogramwithjava.com. I’ll post it here as another solution so that everyone may benefit :)

Assignment #4 – The Anagram

Before you read through and download this assignment, I’d like to ask you for a favour. Back in October of 2012 I decided to quit my 9-5 day job and take a run at doing what it is I love to do full-time: creating fun and educational tutorials like this one. So since this has now become my livelihood, it would really mean the world to me if you took a few seconds to share this content with the world. The more people I have sharing this stuff, the more chance I’ll have at being able to continue doing what it is I love, and that’s helping YOU guys out. So if you have a moment, please click one of the sharing options to the left of this, and if you do I humbly thank you.

Click Here to download the assignment files for Java practice assignment #4. Video instructions on how to install these files into your IDE can be seen at the bottom of this post.

This is one of my favourite types of assignments, it’s an algorithm assignment. This type of assignment is design to test your skills at creating an algorithm that will solve the presented problem. Remember that there are MANY ways to solve this problem, your goal should be to create code that is as efficient as possible. Your task for Java practice assignment #4 is to code an anagram solver. First of all, we’ll define the term “anagram” for this assignment:

An anagram is considered to be a pair of words that are made up of the exact same letters. Think of it like taking one word, then just scrambling the letters around until you can spell another word. For the purposes of this assignment we’ll only be dealing with single word anagrams, as there are certainly anagrams that can be formed by multiple words (but let’s not worry about those ones). Here are some examples of valid anagrams:

care -> race
tool -> loot
cloud -> could

An example of words that a NOT anagrams:

tool -> toll (doesn’t have the exact same number of letters)
cloud -> clouds (one word is longer than the other)

So, your task will be to create a method that will return true or false (anagram or NOT an anagram) based on the two Strings that will be passed in. Be sure to follow the instructions included in the assignment files!

Installation Instructions

Here’s a quick video that will explain how to install this assignment:

{ 2 comments… read them below or add one }

Leave a Comment

Powered by sweet Captcha

Previous post:

Next post: