首页 养生问答 疾病百科 养生资讯 女性养生 男性养生
您的当前位置:首页正文

基于Java的哈夫曼编码译码系统 报告

2022-08-06 来源:华佗健康网
自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

课 程 设 计

课程名称 Java与面向对象程序设计

课程设计

题目名称_基于Java的哈夫曼编码译码系统 学生学院 自动化学院 __ __ 专业班级______网络三班____________ 姓名:__________曾庆伟____________ 学号________31080001332__________ 指导教师________张 钢____________

2011 年 6 月 10 日

1

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

目 录

2

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

1.问题描述和分工情况

1.1 问题描述

使用Java语言实现哈夫曼算法,对英文文章进行编码和译码。输入输出界面要求使用Web页面,用JSP实现。

1.2 分工情况

组长:曾庆伟 在本课程设计是负责如下工作:

1, 环境的搭建(主要是web服务器的搭建)

2, 代码编写工作,实现本课程设计的主要功能,即对英文的编码以及译码。

3, 主要的界面设计,主要是设计jsp的界面

组员1:徐华涛 王锦贤 周基霖

1,主要负责上网搜索26个英文字母在文章中出现的概率,并且根据哈夫曼算法设计出 26个字母对应的编码。

……2,画出设计的编码图…

2.系统总体设计

2.1 系统设计方案综述

设计方案:

这个课程设计就是围绕着吧哈夫曼编码体现出来的目的做的

第一步是把在输入框中的字符串——也就是需要编码的文章转成01的字符串。这里我设计成可以显示出来01字符串

第二步,在本地,也就是输入框那个jsp页面吧他的类型转成byte,这样就真正实现了他的目的——传送的时候能节省流量。

2.2 系统模块设计

没什么模块的,就是一整体实现那功能。 无数据库

就是简单的传送文件

2.3 数据库设计 2.4 系统功能设计 2.5 界面设计

3

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

很简单的黄绿两种颜色:

2.6 开发环境描述

开发环境是在Macromedia Dreamweaver 8 上进行的。

4

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

主要是因为这个课程设计的要求比较简单,还有因为方便设计界面,.

3.系统详细设计

3.1 网上搜索资料abc26个英文字母出现概率

E - 0.1268 T - 0.0978 A - 0.0788 O - 0.0776 I - 0.0707 N - 0.0706 S - 0.0634 R - 0.0594 H - 0.0573 L - 0.0394 D - 0.0389 U - 0.0280 C - 0.0268 F - 0.0256 M - 0.0244 W - 0.0214 Y - 0.0202 G - 0.0187 P - 0.0186 B - 0.0156 V - 0.0102 K - 0.0060 X - 0.0016 J - 0.0010 Q - 0.0009 Z - 0.0006

3.2 画哈夫曼编码图为(加入了字符,。!等等)

5

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

1 一 二 三 四

一 L 。 G Y 回车 ‘ ! - ( ) , S A

6

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

二 O R D B P 三 T N W M F V K X J Z Q End 7

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

四 E I

3.3 转成编码为:

'a':\"0010\" 'b':\"010010\" 'c':\"111100\" 'd':\"01000\" 'e':\"110\" 'f':\"101111\" 'g':\"000010\" 'h':\"111110\" 'i':\"1110\" 'j':\"1011001110\" 'k':\"10110010\" 'l':\"00000\" 'n':\"1010\" 'm':\"101110\" 'o':\"011\" 'p':\"010011\" 'q':\"10110011111\"

'r':\"0101\"

H C U

8

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

's':\"0001\" 't':\"1000\" 'u':\"111101\" 'v':\"1011000\" 'w':\"101101000\" 'x':\"101100110\" 'y':\"000011\"

'z':\"10110011110\"

' ':\"00110000\" ',',\"001111\" '.',\"001110\" '\\'':\"001100011\" '!':\"00110010\" '-':\"00110011\" '(':\"0011010\" '':\"0011011\"

3.4 系统主要函数及其功能描述 3.5 核心代码片段描述和注释

4.系统部署

4.1 开发环境的建立

开发环境:

Web服务器用的是Apache 编写代码的工具: Dreamweaver 8

4.2 系统运行环境的建立

运行的操作系统是windows XP 浏览器是用IE8

4.3 系统的部署和运行

9

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

5.系统测试和运行效果

5.1 系统运行主要界面及其功能说明

在这个输入框中输入要编码的文章。然后点击转成哈夫曼编码按钮即可。

5.2 系统测试数据描述

输入测试文章为:Christmas celebrations in the West today

From November onwards, it is impossible to forget that Christmas is coming. Coloured lights decorate many town centres and shops, along with shiny decorations, and artificial snow painted on shop windows.

In streets and shops, 'Christmas trees' (real or plastic evergreen 'conifer' trees) will also be decorated with lights and Christmas ornaments.

Shopping centres become busier as December approaches and often stay open till late.Shopping centre speaker systems systems will play Christmas 'carols' - the traditional Christmas Christian songs, and groups of people will often sing carols on the streets to raise money for charity. Most places of work will hold a short Christmas party about a week before Christmas. Although traditional Christmas foods may be eaten, drink (and plenty of it) means that little work will be done after the party!

By mid-December, most homes will also be decorated with Christmas trees, coloured lights and

10

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

paper or plastic decorations around the rooms. These days, many more people also decorate garden trees or house walls with coloured electric lights, a habit which has long been popular in USA.

In many countries, most people post Christmas greeting cards to their friends and family, and these cards will be hung on the walls of their homes. In UK this year, the British Post Office expects to handle over 100 million cards EACH DAY, in the three weeks before Christmas. Christmas cards

The custom of sending Christmas cards started in Britain in 1840 when the first 'Penny Post' public postal deliveries began. (Helped by the new railway system, the public postal service was the 19th century's communication revolution, just as email is for us today.) As printing methods improved, Christmas cards were produced in large numbers from about 1860. They became even more popular in Britain when a card could be posted in an unsealed envelope for one half-penny - half the price of an ordinary letter.

Traditionally, Christmas cards showed religious pictures - Mary, Joseph and baby Jesus, or other parts of the Christmas story. Today, pictures are often jokes, winter pictures, Father Christmas, or romantic scenes of life in past times.

5.3 系统运行和测试结果

运行的结果显示为:

11110011111001011110000110001011100010000100110000111100110000001100100100101001010001110011101000010011000011101010001100001000111110110001100001011010001100001100000110000100001101000001000001100110000001100010010111101010111011100011000010100111011000110101110010010110010100110000011101010110100000100101010000001001111001100001110100000110000111000010011000011101011100100110110001000111100100100000011000110000100001100110000101111011010100001011010000011000010001111100010100000110000111100111110010111100001100010111000100001001100001110000100110000111100011101110111010100000100011100011000011110001100000011111101010111001000001100000000011100000101111101000000100110000010001101111000110101001010001100011000010111000101010000011001100001000011101101000101000110000111100110101010000101110000100110000001010100100000110000000111111001101001100010011110011000000100000001110100000100011000010110100011101000111110001100000001111110111010100000110011000001000110111100011010100101000111001110100001001111001100000010101001000001100000010010110001110101111111011110011100010000000011000000011010011101101000001100000100110010111010101000110010000011000001110100011000000011111100110100110011000010110100011101010010000111011010000001001110001100000011000100001100010011101010001100000001100001011101101000000100110000001010100100000110000000111111001101001100010011110011000000110001111110011111001011110000110001011100010000100

11

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

110000100001011101100001001100011001100000011010010111000100000000110000011010100110000010011000000010000110001110111100001100001101011000110010100001001011101101010001100000011000111111000111010111010111111001010011000110011000010000101110110000100110110011000010110100011100000000000001100000010000000001011001100000100101100011000001000110111100011010100101000110010000011000010110100011101000111110001100000000011100000101111101000000100110000001010100100000110000111100111110010111100001100010111000100001001100000110101101000101011101101010100000010011100011000000110001000011000000110000001100010000011111100110100110100111110101000001000110000111100110101010000101110000100110000010010110111100011101110110001100000100101111010001111011001010011000000100001001100000100011011110011010111001001011001010011000000100100110100110101011001011110011111011000010011000000101010010000011000001110111110001101010001100000001100000100000110011000001101001111010100011000010001110000000000000110000000000010100011000111000011111100110100110100111110101000001000110000111100110101010000101110001100000001010011110001010110010110010100110000000100001100011000110101110000100110000000100001100011000110101110000100110000101101000111000000000000011000001001100000001000001100110000111100111110010111100001100010111000100001001100000011000111111000010010101100000000100110001100110000001100110011000010001111101100011000010000101001001000111010001110011101000100000000110000111100111110010111100001100010111000100001001100001111001111100101111000011000111000101010001100000001011101000001000010011110011000000101010010000011000000001001010111111010100110001001100000111011110011000001001111001101001100000110001100001011010001110000000000000110000011101111100011010100011000000011110101000001000110000111100001001010110000000010011000001110100011000010001111101100011000000011000010111011010000001001100001000011001100000101001011100001110001100001011100111010110000011001100001011110110101001100001111001111100010010111101000000011001110001100001011100110001100000110000010011000000010111100110000100110000011101111001100001011010000110101101100100011000010110100011100000000000001100001111100110000001000001100000010001100000001111110011010110000011000011110011111001011110000110001011100010000100110000010011001001011000000011001100000010010010011111101100000110000001000110000101101000110110101100100011000001001011010111101101011100011000011110011111001011110000110001011100010000100111000110000001000000100011111001111110100001011111000110000100001010010010001110100011100111010001000000001100001111001111100101111000011000101110001000010011000010111101101101000000100110000101110001000001100110000010010110001100001100010100011010100011110011000001000010111101010101100100011000000110100010101001000001100000100110000011010101000000011001100000111011110011000011101000001101100110000101110110001010100001001100001000111110001010000011000000000111010001000000001100011000010110100001101011011001000110000101101000111000000000000011000001001011000110000010000111010110001100000010101111100011001010011000010001111101100011000001001100100101100000001100110010001100000011000100010010000011001100001011101110010000011001101000110111100110101110010010110010100111100110000101110011000110000011000011111001110111011000010011000010110100011100000000000001100000010000000001011001100000100101100011000001000110111100011010100101000110010000011000010110100011101000111110001100001111001111100101111000011000101110001000

12

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

010011000010000101110110000100111100110000111100011000000111111010101110010000011000000000111000001011111010000001001100000010101001000001100000100110010010011110010100110000011010100110000010011000000010000110001110111100001100000100011011110001101010010100011100111010000100110000001001010111111011010010000011000010001111101100011000001010110111011100001001110001100001000111110110000111000110000010000010000011000100111100110000101110001010100000110011000010111001101011100011000001001111001101001100000110001100000010000000001011001100000100011011110001101010010100011000110000000010001001010100011010100011000010000101110110000100110000011010100110000111110011111101000111000110000101101000001000000000000001001100001011010001110100011111000110000111100011000000111111010101110010000011000011000000110111100100001011110111100001100000000011100000101111101000000100111100110000001000110000111110001001001011101000001100001011010001111101110111100111110001100001111100010000100110000000000111010000010001100000100101101101010001100000100110110100111111010000000100101001100001110101000110000111101000100100011100011000100001100000011000000110000001100010011101010001100001011100010101000001100110000111100011111101101010000101111011000010011110011000010111001100011000001100000100111100110100110000011000110000010011011000110000011000011110011111001011110000110001011100010000100110000000010010111011010001110101000001000110000111100001001010100000010011000010000110011000010001111101101110010100110000101111010111101101010010000001001100000010101001000001100001011110010101110111000000000011001111001100000010101001000001100001000111110110000111000110000111100001001010100000010011000010110100011100000000000001100000100101100011000011111011110110100000100011000001110100011000010001111101100011000010110100000100000000000000100110000011101111001100001000111110110111001010011000011111001110111011000010011100011000011101010001100001111011011001000110000100011111011100001001100000000111100010010100111100110000100011111011000110000010010010111101000111000011111100011000001001101100011000001100000111011111011111110111100110001100001101011001100100111101111001000000100110000100001100110000111110001010100100000000110001100000111011000110010100110000111111101101111111011011111100110000101110111000000000001110011101000110000111100001001010100000010011000011000101111001111100011000001000001000001100111100110000111010100011000010001111101100011000010001111100101110110001100001011010001101101011001000010011000001001011010111101101011100011000011110011111001011110000110001011100010000100111000110000001100010011110011111001011110000110001011100010000100110000111100001001010100000010011000000110001001000111110110001100001111001111010001100001110111000110000011101111001100000001110101001000111010100000100011000011110011111001011110000110001011100010000100110000111100001001010100000010011000000011000001001011000110010000011000011101010001100000100100101111010000010111010100011000011101010001100001111111011011110101101100101101111110011000010110100011111011010100011000010001111101100011000010111111100101000110000011000000110001101001111010101010000011001100000100110110001100000110001100110000010011111101010010000001110111100001100000100110110001100000100000000110000010001100000011101011000110010111101100001001100000100101100000100010101000111000110000001101011111011000000010011110010000011000001001000001100110000100011111011000110000101011010110100000110000010100101110000001011010000010000011001

13

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

1000000010000110001100011010111000111100110000100011111011000110000010011111101010010000001110111100001100000100110110001100000100000000110000000111001011011000111011110011000110000101101000001000010011000010001111101100011000011111110110111110100011111000110000111100110101010001111010101000011001100011000100110000111100011101110101110111101101011101111000010100011100111010001100000101110101100001100000111101100011100111010001111001100001011001110111101000110000011000000100001001100001101011100010111000000001100001110000100110000101111011010100110000111101000100110000100001101000001000001100111000110110011000000100001001100000100110101111010101000111010100000100011000010111011010001111100110100000010011000011101011100100110101011101100011001000001111001100001111001111100101111000011000101110001000010011000011110000100101010000001001100001011010001100101110001100000100110101011010001111011111001100100000110000111010100011000000000001001010000101100011000010101111011011100100101100101000100110000101111010101110111000110000001001001001111110110000011000011111110110111101011011101101101111110011100011000010001111101100000110011000001001011011110000101011101100011000011010110001101010001100001011100110101110001100000100110110100111111010000000100101001100001110101000110000010010010111101000001011101010001100001011010001111101101010001100000010001100001111000010010101000001100001111000111111010000001000001100000100101100011000001001101100011000110010000011000011101010001100000010101000110000111101101000011100010000001100100000110000110101010110001100000001101001111000110000101111011010100110000011101011000110000111110001000000101111001100110100111101010101000001100110000001100110011000011111000100000010111100110000100011111011000110000010011010111101111001100011000001110111100110000001010100011000001101010100011101010001001010000110011000000000110100010001100101001110001100000011000100001100010010000101001001000111010001110011101000100000000000000011001111001100001111001111100101111000011000101110001000010011000011110000100101010000001001100000001111110011101101000110010000011000001011100000011100000101110011111101000100110000010011111011110010001111010101110000100110000001100110011000010111000100101000011001111001100001011001110011000111001001111111000110000001010100100000110000010010001001001000001100110000101100111011000011111010001001111001100000110101001100000111000111110110010100110000010011001001011000000100110000011101111001100001000111110110001100001111001111100101111000011000101110001000010011000000011000011010100001100111000110000100001101000001000001100111100110000010011111011110010001111010101110000100110000001001011100011000001110111110001101010001100001011001110011101100101100001001111001100001011010001110101010001100101001100000100111110111100100011110101011100001001111001100001011110010100011111011001010011000011110011111001011110000110001011100010000100111100110000011010100110000010101110111000101010100011101111000011000000011111001101010110000100110000011101111001100000000011101011111100011000011101010001100000100110010000110000011000010001110101110110000100111000110001000011000000110001001011001111110000000 然后再点击转成abc英文按钮即可转回去: Christmas celebrations in the West today

From November onwards, it is impossible to forget that Christmas is coming. Coloured lights

14

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

decorate many town centres and shops, along with shiny decorations, and artificial snow painted on shop windows.

In streets and shops, 'Christmas trees' (real or plastic evergreen 'conifer' trees) will also be decorated with lights and Christmas ornaments.

Shopping centres become busier as December approaches and often stay open till late.Shopping centre speaker systems systems will play Christmas 'carols' - the traditional Christmas Christian songs, and groups of people will often sing carols on the streets to raise money for charity. Most places of work will hold a short Christmas party about a week before Christmas. Although traditional Christmas foods may be eaten, drink (and plenty of it) means that little work will be done after the party!

By mid-December, most homes will also be decorated with Christmas trees, coloured lights and paper or plastic decorations around the rooms. These days, many more people also decorate garden trees or house walls with coloured electric lights, a habit which has long been popular in USA.

In many countries, most people post Christmas greeting cards to their friends and family, and these cards will be hung on the walls of their homes. In UK this year, the British Post Office expects to handle over 100 million cards EACH DAY, in the three weeks before Christmas. Christmas cards

The custom of sending Christmas cards started in Britain in 1840 when the first 'Penny Post' public postal deliveries began. (Helped by the new railway system, the public postal service was the 19th century's communication revolution, just as email is for us today.) As printing methods improved, Christmas cards were produced in large numbers from about 1860. They became even more popular in Britain when a card could be posted in an unsealed envelope for one half-penny - half the price of an ordinary letter.

Traditionally, Christmas cards showed religious pictures - Mary, Joseph and baby Jesus, or other parts of the Christmas story. Today, pictures are often jokes, winter pictures, Father Christmas, or romantic scenes of life in past times.

6.总结

6.1 系统开发总结

通过本次课程设计使我对哈夫曼树及哈夫曼编码有了更深刻的理解,同时对java的编程以及算法的实现产生了比较大的兴趣。还学到了许多在处理程序时

15

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

的技巧和方法,这都对以后的学习大有裨益,以及感受到在编程设计中团队合作精神的重要性。

在这次程序设计中,我觉得重要的一点,那就是不要人云亦云,要有自己的主见,不管别人如何,一定要有自己的思想,并且始终不改变的去坚持,纵然,可能会遇到很多难以解决的困难,都要自始到终,相信自己能把这个程序做得出来。当自己最终在自己的努力下完成任务的时候,那就会有更多属于自己的收获,包括成功的喜悦以及程序中体现的思想。

其次是我认为调试功能是整个编写程序过程中很重要的一个环节。通过此次实验我对调试有了更加深刻的理解,懂得怎么样去调试程序,如何发现错误,如何更高效的改正,最终能把程序实现。

6.2 心得体会

组长 曾庆伟 心得体会: 对BYTE类型的操作和持有对象的使用更加深刻了。这个程序还是有很多不足的 虽然java是面向对象的,但是我还是用了很多面向过程的技巧来解决实际问题。以后会多加注意。

组员1 徐华涛 心得体会:通过本次课程设计,加深了我对java的了解及运用,也从中学会了怎样去写、如何去写程序。同时也知道所有程序必须从踏踏实实中来。

组员2 王锦贤 心得体会:通过本次课程设计,加深了我对java的了解及运用,同时也从这次课程设计学会了课堂上没法学会的知识。

组员3 周基霖 心得体会:通过这次课程设计,加深了我对java的了解及运用,这次课程设计,我也是给组长打打下手,同时也懂得了程序该如何去写,怎样去写。

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

……..

7.参考文献和资料

[1]《Java编程思想》……………………………………………美Bruce Eckel 陈吴鹏 译 [2] Java面向对象程序设计[专著]= Obiect-oriented programming with Java/张亦辉, 冯华, 胡洁编著

16

自动化学院网络工程系网络信息08级X班 面向对象技术课程设计报告 指导教师:张钢 组长:曾庆伟 组员:徐华涛 王锦贤 周基霖 题目:基于java的哈夫曼编码译码系统

教师评语和评分

教师评语:

教师评分:_____________

教师签名: 日期:

17

因篇幅问题不能全部显示,请点此查看更多更全内容