一份英国电子商务本科生的习题,大家来帮帮忙,说说算法就可以:)

KyosukeNo1 2003-07-03 02:46:54
You are required to design and implement (in Java) the front end of a web-based SMS (Short Message Service) gateway that will allow Internet users to send text messages to mobile phones.

SMS messages can be comprised of words or numbers (alpha-numeric characters) up to 160 characters in length. This limitation on message length, combined with the inconvenience of using mobile phone keypads for typing text has helped give rise to a popular culture of SMS abbreviations, similar to that found in internet chat-rooms. “b4n”, “L8”, “b4” and “btw” are examples of such usage (“bye for now”, “late”, “before” and “by the way”).


Your task at this stage is to design and write a Java program that will :

1) Prompt the user for a mobile phone number.
2) Verify the number is in a valid format (ie exactly 11 numeric characters etc).
3) Prompt the user for a text message.
4) Where possible, encode the message using SMS abbreviations.
5) Display the encoded (abbreviated) message to the user.
6) If text size still exceeds 160 characters, prompt user to edit the message.
7) Display the percentage reduction produced by this coding.

Bonus task:
O Implement a decoding algorithm that would recover the original text message from an abbreviated version.
...全文
21 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ytdmm 2003-07-05
  • 打赏
  • 举报
回复
该问题好像没有涉及到数据发送方面,只是考虑按照一定的算法进行数据压缩和解压缩
daromario 2003-07-04
  • 打赏
  • 举报
回复
这个,sms(好像就是,短消息发送机制),这个与聊天的做法差不多。
1.首先:进行手机号用户验证。

2.这个号,在程序里用特殊的技法进行存储和发送。以便电信部门的消息交换机,能够顺利的分离出来。在进行消息的转发。

3.在用户写完消息后进行发送。比如你的数据以如下格式。(#130。。。。。#message#time data#你要发送的号。138。。。。。)。

4电信部门的处理机,获得此消息后,首先分离出,130。。。。。这个信息,然后是138。。。。。这条信息,然后把message和time data发送给138。。。。。。再在另一个用户的屏幕上,显示出来。

5.在服务器端,先判断,message的长度是否160,没有,这进行发送,若超出160,这先把160个字节转发。然后把后后面的剩余字节,在进行转发。若是才用自己某种算法,进行优化。

xiaowanzi0412 2003-07-04
  • 打赏
  • 举报
回复
ytdmm 2003-07-03
  • 打赏
  • 举报
回复
1,2,3都很简单,只需要进行简单的提示和验证

4,要求利用SMS abbreviations将message进行压缩。在message中依次查找abbreviations中可以压缩的所有短语(bye for now,late等),并将其替换成相应的缩略语后另行存储

5,将替换之后的message显示

6,判断其长度并做相应提示

7,计算压缩替换之后的message和替换之前的message的长度之比

0,在压缩之后的message中依次查找abbreviations中所有的缩略语,并作相应还原

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧