describe this java code in one sentence about what it does. } public String mystery (String dna)
Fantastic news! We've Found the answer you've been seeking!
Question:
describe this java code in one sentence about what it does.
Transcribed Image Text:
} public String mystery (String dna) { int pos = dna.indexOf("T"); int count = 0; int startPos = 0; String newDna = if (pos == -1) { return dna; } } while (count < 3) { count += 1; newDna = newDna + dna.substring(startPos, pos); startPos = pos+1; pos = dna.indexOf("T", startPos); if (pos == -1) { break; } } newDna = newDna + dna.substring(startPos); return newDna; } public String mystery (String dna) { int pos = dna.indexOf("T"); int count = 0; int startPos = 0; String newDna = if (pos == -1) { return dna; } } while (count < 3) { count += 1; newDna = newDna + dna.substring(startPos, pos); startPos = pos+1; pos = dna.indexOf("T", startPos); if (pos == -1) { break; } } newDna = newDna + dna.substring(startPos); return newDna;
Expert Answer:
Answer rating: 100% (QA)
Method Overview The mystery method takes a string parameter named dna and returns a new string that ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Assignment 5: Hash Table implementation andconcordance There are three parts to this assignment. In the first two parts,you will complete the implementation of a hash map and aconcordance program. In...
-
(a) Explain how a limit worth may be tended to at run-time, both in a syntaxtree middle person and in collected code. What is the importance word "settled" already? [3 marks] (b) Give a model program...
-
In August 2014, Jim acquired a 99-year lease on a flat for 170,000. In August 2020, he assigned the lease to Shirley for 212,000. The flat was never Jim's residence. Compute the chargeable gain.
-
A diffusion couple similar to that shown in Figure 5.1a is prepared using two hypothetical metals A and B. After a 20-h heat treatment at 800C (and subsequently cooling to room temperature) the...
-
This chapter discussed many inputs to an organizations sales process. What are the specific data items needed to add a new customer and record a sales order?
-
A hemispherical bowl of radius \(R\) is placed in a uniform magnetic field that has magnitude \(B_{0}\) and is in the positive \(z\) direction. The open top of the bowl is in the \(x y\) plane....
-
The Grilton Tire Company manufactures racing tires for bicycles. Grilton sells tires for $50 each. Grilton is planning for the next year by developing a master budget by quarters. Griltons balance...
-
29. If A 21+j+k and B=1+2j+2k, find the magnitude of component of (A+B) along B: (1) 4 unit (2) 5 unit (3) 6 unit (4) 7 unit 30. Which of the following group of forces cannot produce the resultant of...
-
1 Carry out a PESTEL analysis of Alibaba at the time of the case. Evaluate the balance of opportunities and threats, using the same kind of figure as in Illustration 2.1. 2 Draw a basic sociogram of...
-
I have the first part of the answer I just need the balance sheet and last part of the entry. Please answer all of the questions and don't waste my question. Please create the entries and balance...
-
Question No 2: Among a large group of patients recovering from shoulder injuries, it is found that 25% visit both a physical therapist and a chiropractor, and 85% visit at least one of these. The...
-
Whiplash Technologies reports operating expenses of $2 million. Operating expenses include rent expense. Prepaid rent at the beginning and end of the year are $20,000 and $70,000, respectively. All...
-
What kind of report provides data or findings, analyses and conclusions, and may also provide recommendations if requested?
-
A horizontal lever of length 4 m is pivoted at its midpoint. A 20 N upward force (force with a vertical component that makes an angle of 30 with the horizontal-left is acting at a point .3 m away...
-
Midwest Office Products was underestimating the profitability of each order based on the true expenses of both the delivery mechanism (freight vs. truck delivery) and late payments while using the...
-
A well-mixed water tank with an inlet flow and an outlet flow is used to collect solar thermal energy. Both the inlet and the outlet flow rates are the same: F (kg/s). The water in the tank has a...
-
If M = 7, s = 2, and X = 9.5, what is z?
-
Implement a subclass of BankAccount from How To 9.1 called BasicAccount whose withdraw method charges a penalty of $30 for each withdrawal that results in an overdraft.
-
Develop a set of test cases for the algorithm in Exercise E3.14. Data from Exercise E3.14. Draw a flowchart for the algorithm in Exercise E3.13. Data from Exercise E3.13. Draw a flowchart for the...
-
Write two methods public static void drawHouse(Graphics g, int x, int y) public static void drawCar(Graphics g, int x, int y) that draw a house or car at a given position. Then write a program that...
-
What is the Standard Industrial Classification (SIC)? In what ways might such a classification system be useful? Can you think of any limitations or problems such a system might have over time?
-
1. In what ways did the defence industries respond to the ending of the Cold War? 2. Using an Internet search, find out how the defence and security industries have responded to the threat of...
-
Explain why the business objectives of owners and managers are likely to diverge. How might owners attempt to ensure that managers act in their interests and not in the managers own interests?
Study smarter with the SolutionInn App