- 资源介绍
- 更新记录
- 安装教程
若有个人部署运行问题,点击右侧客服按钮咨询站长
项目介绍
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?
运行截图
关注【程序代做 源码分享】公众号获取更多免费源码!!!
猜你喜欢
-
html网上订餐页面
2021-05-20 -
比较专业的公司网页5页面
2021-05-14 -
html5飞机大战游戏源码
2021-05-02 -
图片上生成水印图片并保存合并图片升级版
2021-09-07 -
进度报告单页面
2021-05-18 -
html前端4页面早教课程网页源码
2021-05-12 -
电商平台后台静态页面html
2021-07-08 -
国外动物介绍网页
2021-05-18 -
html前端飞机大战
2021-09-07 -
网上小店html10页面
2021-09-07
-
简单学生北京介绍页面
2021-05-18 -
html前端紫色个人简介网页源码
2021-05-12 -
Pig Latin Lab The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
2021-05-14 -
登录和后台系统界面html
2021-07-31 -
网页集合
2021-09-08 -
旅游网页6页面英文版
2021-09-07 -
html前端校园介绍网页10多个页面
2021-05-14 -
html前端保护树木公益5网页
2021-05-14 -
Forms and Input Elements of HTML The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
2021-05-18 -
5个网页制作课作业
2021-09-08
猜你在找
99源码网 » Pig Latin Lab The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 99源码网
- 2021-05-14Hi,初次和大家见面了,请多关照!