- 资源介绍
- 更新记录
- 安装教程
若有个人部署运行问题,点击右侧客服按钮咨询站长
项目介绍
Pig Latin Lab The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
适用场景
系统说明
Pig Latin Lab
The George Washington University
Computer Science 1023
Professor Brenner (nbrenner@gwu.edu)
Create a webpage to translate words from English to Pig Latin. Pig Latin is a secret language used by American children to disguise their conversation from the ears of others. E.g. “Igpay Atinlay isway away ecretsay anguagelay.” The rule is to move all the initial consonants to the end of the word and add “ay”. If the word begins with a vowel (viz. one of “a”, “e”, “i”, “o”, or “u”), then just add “way”. So, “this” becomes “isthay” and “strong” becomes “ongstray”. Sample HTML:
Hints on implementation
- When retrieving the contents of a textbox with the .value property, remember that this is always a string. (And recall that the plus sign performs addition only if both its left and right argument are numbers; if either is a string, the two arguments are joined as strings.)
- Create a for loop which runs the number of times equal to the number of letters in the input word. On each turn of the loop, extract the next letter from the string of the word. Review the Javascript string functions, as described in the last handout.
- You will build up the output (Pig Latin) word one letter at a time, but you must also build up a string containing the initial consonants, also one letter at a time. Create a variable which is true while in the initial consonant group, but which changes to false when the first vowel is found. Then an if statement inside the for loop will look at this variable, and decide what to do with the current letter.
- Create a string to hold the five English (really Latin) vowels. E.g.:
vowels = “aeiou”
Then you can use string searching to determine if a letter taken from the input word is a vowel or not (or you could use a slower if statement).
- When you come to the end of the word (i.e. after the for loop finishes), create the complete Pig Latin word by joining the strings you created in step 3, and append the proper tail. Display it in the output text box.
- Don’t bother about UPPER CASE vs. lower case; assume only lower case (convert the examples I give in this handout, if you use them).
- [Optional, for advanced programmers] Three improvements can be made to this program.
- The input can be a sentence, i.e. of words separated by blanks. [Even more optionally, permit separation by punctuation marks like comma or period.]
- Input words can begin with the letter “q”. Since a following letter “u” may act as a consonant (viz. like a “w”), you must treat it as a consonant; examples: “quiet” → “ietquay”, “quality” → “alityquay”. But in names from the Middle East, “q” is a solo consonant: “Qatar” → “Atarqay” and “Qumran’ → “Umranqay”. And don’t forget about “qubit” (→ “ubitqay”).
- “y” is sometimes a vowel; e.g. “sky”, “hyper” (→ “yskay”, “yperhay”). How can you distinguish these from “yogurt” (→ “ogurtyay”), where “y” is a consonant?
运行截图
关注【程序代做 源码分享】公众号获取更多免费源码!!!
猜你喜欢
-
java springboot+vue的在线学习平台前后端源码
2021-05-28 -
html前端比较好个性5页面简历
2021-05-13 -
SSM停车场管理系统、
2021-10-04 -
学校主页2页面
2021-05-14 -
5个网页制作课作业
2021-09-08 -
html前端校园介绍网页10多个页面
2021-05-14 -
html页面旅游网页前后台页面
2021-05-28 -
拖拽添加文字水印
2021-09-07 -
html5飞机大战游戏源码
2021-05-02 -
国外动物介绍网页
2021-05-18
-
html网上订餐页面
2021-05-20 -
环保5页面
2021-05-18 -
html电商网页10页面
2021-05-14 -
旅游网页6页面,广安市前锋区+课程设计报告
2021-09-07 -
html美食展示页面
2021-05-20 -
html前端4页面早教课程网页源码
2021-05-12 -
旅游网页6页面,湘西+课程设计报告+毕业论文
2021-09-07 -
图片上生成水印图片并保存合并图片升级版
2021-09-07 -
Creating a Log-in Webpage The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
2021-05-14 -
h5 pc摄像头
2021-10-25
猜你在找
99源码网 » Pig Latin Lab The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 99源码网
- 2021-05-14Hi,初次和大家见面了,请多关照!