You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of this exercise is to introduce you to the concept of objects and classes. These are fundamental building blocks for OOP (Object Oriented Programming). You shouldn't need to write a ton of new code, in fact you can re-use your solution from the Simon Says exercise!
2
+
3
+
The key here will be rewriting certain bits of it to work within the class given to you.
The goal for this exercise is to create a calculator that does the following:
2
+
3
+
add, subtract, get the sum, multiply, get the power, and find the factorial
4
+
5
+
In order to do this please fill out each function with your solution. Make sure to return the value so you can test it in Jasmine! To see the expected value
6
+
take a look at the spec file that houses the Jasmine test cases.
Pig Latin is a children's language that is intended to be confusing when spoken quickly. Your job for this exercise is to create a solution that takes the words given and
2
+
turns them into pig latin. Please see the following wikipedia page for details regarding the rules of Pig Latin:
3
+
4
+
https://en.wikipedia.org/wiki/Pig_Latin
5
+
6
+
The rules section will give the rules and the examples that are required to complete this exercise.
// Pig Latin is a made-up children's language that's intended to be confusing. It obeys a few simple rules (below) but when it's spoken quickly it's really difficult for non-children (and non-native speakers) to understand.
9
+
10
+
// Rule 1: If a word begins with a vowel sound, add an "ay" sound to the end of the word.
11
+
12
+
// Rule 2: If a word begins with a consonant sound, move it to the end of the word, and then add an "ay" sound to the end of the word.
13
+
14
+
// (There are a few more rules for edge cases, and there are regional variants too, but that should be enough to understand the tests.)
15
+
16
+
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
17
+
18
+
varpigLatin=require("./pigLatin.js");
19
+
20
+
describe('#translate',function(){
21
+
it('translates a word beginning with a vowel',function(){
22
+
s=pigLatin.translate("apple");
23
+
expect(s).toEqual('appleay');
24
+
});
25
+
26
+
it('translates a word beginning with a consonant',function(){
27
+
s=pigLatin.translate("banana");
28
+
expect(s).toEqual("ananabay");
29
+
});
30
+
31
+
it('translates a word beginning with two consonants',function(){
32
+
s=pigLatin.translate("cherry");
33
+
expect(s).toEqual('errychay');
34
+
});
35
+
36
+
it('translates two words',function(){
37
+
s=pigLatin.translate("eat pie");
38
+
expect(s).toEqual('eatay iepay');
39
+
});
40
+
41
+
it('translates a word beginning with three consonants',function(){
0 commit comments