Question

In: Computer Science

Each person in the group will be responsible for rewriting the code to solve one   of...

Each person in the group will be responsible for rewriting the code to solve one   of the original   parts (Alphabetizing 5 words, pig latin, reversing letters, celebrity names), without using arrays   or loops. The purpose of this assignment is to practice Strings manipulation and String methods so full credit will only be given if you are utilizing the code for Strings (substring, charAt, compareTo, equals, etc). Within the group, you cannot work on the same program so only one person can submit pig latin, and one person can submit reversing letters, etc.
English
dog
Apple
easy
Cattle


Remove your old code and replace it with this new code before testing the program again. Be sure to leave a comment indicating what you have changed.

(I'm only working on the pig latin option)

Solutions

Expert Solution

Here is the pseudo code for pig latin without array and loop

1. Get the length of the string with length ()

2.converting to lower case as it will be easy to compare to get vowel.

3.getting the index location of each lower case vowel using indexOf ()

5.if no occurrence of vowel means indexOf will return -1.

In order to find the first occurrence of vowel with array or loop, we get the location of every vowel and finding the smallest of five. It gives the first occurance. If the particular vowel is not present -1 will return and it will be the smallest number,in order to avoid that we are adding length +1 to that.

6.find the smallest number of 5 by using math function ,math.min

7.first_ occurance denotes the location of first vowel

8.using subString () we seperate the first vowel occurrence in s1 and remaining string in s2

9.using concat () we append s2 and s1

10.using trim () ,removing whitespace

11.appending "ay" at the end with concat ()

As the programing language is not mentioned ,java is used in the below image


Related Solutions

Name the person that is responsible for directing a corporation’s affairs.
Name the person that is responsible for directing a corporation’s affairs.
3. Liability claims in the auto industry? Insurance A) How can one person be held responsible...
3. Liability claims in the auto industry? Insurance A) How can one person be held responsible for another’s actions? What is this type of legal responsibility called? B) Identify three categories of direct commercial liability exposures C) Explain contractual liability and the nature of a hold-harmless agreement. D) How do the insurer's interests sometimes confict with the professional's interest with respect to the opporunity
Case Study and Proposal: Each group is responsible to identify a small business and familiarize themselves...
Case Study and Proposal: Each group is responsible to identify a small business and familiarize themselves with its key business processes and problems (it could be anonymous/fictitious business). In the case study and proposal groups will provide relevant details about the business and identify potential business processes and functional areas where they will use the macros to the improve/automate business processes.
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
9.50. Each person in a group of twenty persons is assigned a random number from 1...
9.50. Each person in a group of twenty persons is assigned a random number from 1 to 100 (both included). It is possible for multiple persons to be assigned the same number, and all assignments are equally likely. What is the probability that at least two persons in the group share the same number?
According to the United States government figures, an unemployed person is one who Group of answer...
According to the United States government figures, an unemployed person is one who Group of answer choices a. Has given up looking for a job. b. Only works part time. c. Cannot be a member of the labor force. d. Works at jobs below his or her skills or abilities. e. Is actively seeking a job.
C++ Plan and code a program utilizing one or more repetition structures to solve the following...
C++ Plan and code a program utilizing one or more repetition structures to solve the following problem: Develop a program to analyze one or more numbers entered by a user. The user may enter one or more numbers for analysis. A number is a multiple of 9 if the sum of its digits is evenly divisible by 9. Determine if a number is a multiple of 9 by adding together the individual digits of the number and determining if the...
3. For your dependent (Y) variable, you code it 0 for each person where CD4 is...
3. For your dependent (Y) variable, you code it 0 for each person where CD4 is below 200 at the end of study and 1 if CD4 is 200 or above. Then you build a model predicting a function of Y based on age, gender, time since infection, and ARV group in predicting whether or not CD4 count is above or below 200 by the end of the study. a. What is the name for this type of model? Many...
Scenario DoEpicStuff started as a 3 person start-up. Two of these three people wrote code. Each...
Scenario DoEpicStuff started as a 3 person start-up. Two of these three people wrote code. Each coder would create database tables as needed. There was no naming convention for the database tables or the fields of the table. There was no established process for checking whether the two tables had fields in common and in that case whether they had the same name or the same data type. The coders were free to add columns to (or even drop columns...
what are the key proprites of person centered therapy? explain each one
what are the key proprites of person centered therapy? explain each one
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT