- 资源介绍
- 更新记录
- 安装教程
若有个人部署运行问题,点击右侧客服按钮咨询站长
项目介绍
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-07-31 -
网上小店html10页面
2021-09-07 -
html前端紫色个人简介网页源码
2021-05-12 -
旅游网页6页面,湘西+课程设计报告+毕业论文
2021-09-07 -
html前端校园介绍网页10多个页面
2021-05-14 -
进度报告单页面
2021-05-18 -
公益网页5页面
2021-05-18 -
html电商网页10页面
2021-05-14 -
单页面旅游介绍
2021-05-14 -
html5飞机大战游戏源码
2021-05-02
-
List and Table Elements of HTML The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
2021-05-18 -
html页面旅游网页前后台页面
2021-05-28 -
网页简易四则运算器
2021-05-18 -
html美食展示页面
2021-05-20 -
Election Website The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
2021-05-14 -
四川羌族文化展览网站界面设计与实现毕业论文+开题报告+Html静态网站源码
2021-06-08 -
html前端6个页面个人简历
2021-05-14 -
简易的电商html
2021-07-08 -
h5 pc摄像头
2021-10-25 -
商城前端html源码
2021-07-08
猜你在找
99源码网 » Pig Latin Lab The George Washington University Computer Science 1023 Professor Brenner (nbrenner@gwu.edu)
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 99源码网
- 2021-05-14Hi,初次和大家见面了,请多关照!