The Artima Developer Community
Sponsored Link

Java Answers Forum
please any help on this project will be appreciated, am very much lost

5 replies on 1 page. Most recent reply: Jul 23, 2003 7:57 AM by Vincent O'Sullivan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
kelvin

Posts: 1
Nickname: knwosu
Registered: Jul, 2003

please any help on this project will be appreciated, am very much lost Posted: Jul 21, 2003 1:33 PM
Reply to this message Reply
Advertisement
In this project, you will implement a Hoffman Code for an input paragraph of
text.
Assignment Details

with the priority queue. You will read in a paragraph of text, and from that
paragraph you should develop a Hoffman code for the characters. This will
involve building a tree using nodes created and stored in a priority queue.
Your program should create a Huffman code from an input string, which the user
will be allowed to enter. You should produce the Huffman code, and print out a
table of the Huffman codes for each character in the string. You should then
produce the output for the string by applying the Huffman code. Finally you
should reverse the process, and from the output string you should use your
Huffman tree to recreate the original input string (NOTE: Do not store the input
string and just print it back. You have to translate the Huffman encoded
string).
Internals of the Program
This program is long and involved, but straight forward. The steps involved are
as follows:
Using a Hashtable (the class Hashtable from java.util) count each character that
occurs in your input string. The key is the character you are processing, and
the data is an object that contains the character and number of times it has
occured. When you find the character, you simply retrieve it from the Hashtable,
and increment the number count of the number of times it has occured. For
example the class for the letter can be:
class LetterFrequency {
Character letter;
int frequency;
String huffmanCode;
LetterFrequency left, right;
}

To add it to the HashTable, use:
Hashtable freqTable;
LetterFrequency = freqTable.get(letter);
if (LetterFrequency == null)
freqTable.put(letter, new LetterFrequency(letter, 1);
else
LetterFrequency.frequency++;


David

Posts: 18
Nickname: malven
Registered: Jul, 2003

Re: please any help on this project will be appreciated, am very much lost Posted: Jul 21, 2003 5:35 PM
Reply to this message Reply
Well, what progress have you made so far? Show us that you are at least trying to solve the problem yourself and many of us would be more inclined to help you. But so far you are just asking people to do all the hard work for you.

leo dawson

Posts: 4
Nickname: omairsoft
Registered: Jul, 2003

Re: please any help on this project will be appreciated, am very much lost Posted: Jul 21, 2003 10:13 PM
Reply to this message Reply
hi there
i can help you with this program. write to me at
softwareobjects_2003@yahoo.com or you can simply get your program done by visiting my homepage and posting the project there and i'll do it for u
http://www.thesoftwareobjects.com

Good luck
leo

David

Posts: 18
Nickname: malven
Registered: Jul, 2003

Re: please any help on this project will be appreciated, am very much lost Posted: Jul 22, 2003 4:10 AM
Reply to this message Reply
Mr. Dawson, you should be ashamed of yourself. The original question is obviously a class assignment, and for you to suggest that he go to your website and pay someone to write the program for him is reprehensible.

I'm continually amazed on this board how many people just post homework assignments, having clearly done no work on their own to even attempt to solve the problem. Giving people the answers does nothing more than ensure that one more incompetent programmer will emerge into our ranks. It certainly does the student no good in the long run.

Toby Donaldson

Posts: 2
Nickname: toby
Registered: Jan, 2003

Re: please any help on this project will be appreciated, am very much lost Posted: Jul 22, 2003 12:11 PM
Reply to this message Reply
I agree, this is shameful. I've taught programming courses, and students do this sort of thing all the time. Some even group together to buy a subscription to an outsourcing site, which only subscribers can read. Fortunately, my experience has been that the students, and those who help them, are not very careful: they don't read the assignment carefully, and so it's not hard to add little twists that a careless reader will miss.

I once had a programmer actually email me the bytecode solution that they did for the student. Apparently, this professional programmer got confused, and thought that my email address was the student's address. Not only that, I decompiled the bytecode, and they did the assignment completely wrong (there were restrictions on which library classes could be used, and the programmer ignored them).

I spent a bit of time researching some web reseach on some of the programmers who offer to do student assignments. Many seem to be between jobs. One even wrote a book. For a pro, these assignments can be pretty easy, so I guess they want to make some quick money. Pretty pathetic.

Anyways, in-class exams do a pretty good job of catching students who don't know what they are doing.

Toby

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: please any help on this project will be appreciated, am very much lost Posted: Jul 23, 2003 7:57 AM
Reply to this message Reply
Given that you are very much lost, isn't the logical person to ask whoever set the assignment?

Vince.

Flat View: This topic has 5 replies on 1 page
Topic: Java Logging API Previous Topic   Next Topic Topic: JTree Node great problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use