The following program works, but its ugly. Modify it to perform the same function with a more
Question:
The following program works, but it’s ugly. Modify it to perform the same function with a more conventional while loop.
Transcribed Image Text:
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner stdIn = new Scanner (System.in); String all Entries=""; for (String entry=""; ;) { System.out.print("Make entry or 'q' to quit: "); entry if (entry.equals("q")) break; else allEntries += " + entry; } // end for = stdIn.nextLine(); System.out.println(allEntries); } // end main } // end class Test
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (1 review)
The given Java program uses a for loop without its usual initialization condition and increment expr...View the full answer
Answered By
Bhartendu Goyal
Professional, Experienced, and Expert tutor who will provide speedy and to-the-point solutions. I have been teaching students for 5 years now in different subjects and it's truly been one of the most rewarding experiences of my life. I have also done one-to-one tutoring with 100+ students and help them achieve great subject knowledge. I have expertise in computer subjects like C++, C, Java, and Python programming and other computer Science related fields. Many of my student's parents message me that your lessons improved their children's grades and this is the best only thing you want as a tea...
3.00+
2+ Reviews
10+ Question Solved
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Question Posted:
Students also viewed these Computer science questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
The site http://virtualpiano.net features an online player piano. If you click on the Key Assist menu just above the piano keyboard, and then Keyboard Keys, you will see that each key is labelled...
-
On 28 April 2020, Mr Guna, CEO of Econ Engineering Malaysia, proposed to complete an abandoned boiler project that no one had dared to revive. He knew that the project was 60% complete before it was...
-
Estimate the number of block accesses required by your solution to Exercise for r1 r2, where r1 and r2 are as defined in Exercise.
-
The following data represent the time, in minutes, that a patient has to wait during 12 visits to a doctor's office before being seen by the doctor. Use the sign test at the 0.05 level of...
-
With reference to Exercise 10.55, find a large sample 95% confidence interval for the true difference of probabilities. Data From Exercise 10.55 10.55 As a check on the quality of eye glasses...
-
Gasoline is sold through local gasoline stations under perfectly competitive conditions. All gasoline station owners face the same long-run average cost curve given by AC = .01q 1 + 100/q and the...
-
The current tourism industry booms in Australia had given the HR department at ANIBT Hotel the opportunity to employ a very diverse range of ethnic employees for all levels of the industry. This...
-
As you learned earlier, an enumerated type is a class (albeit a special kind of class). As such, you can add a main method to it and have that main method run the enumerated type as a program....
-
The Fibonacci sequence is a sequence of numbers such that the first two numbers are 0 and 1, and each successive number is the sum of the two previous numbers. Thus, here are the first nine numbers...
-
Hilda Carr Associates surveys American eating habits. The companys accounts include Land, Buildings, Office Equipment, and Communication Equipment, with a separate Accumulated Depreciation account...
-
What must a prospective purchaser of land do to ensure that the vendor has the right to transfer the property clear of any claims? Does the purchase of title insurance change this answer?
-
In what important respect has the British Columbia Frustrated Contracts Act provided a fairer solution when a contract is frustrated?
-
What is the purpose of a survey?
-
Define tenancy at will, term certain, overholding tenant, subletting, eviction, forfeiture, surrender , and quiet enjoyment .
-
A firm of public accountants has for years been auditing the accounts of a charitable organization without charge. It now appears that the treasurer of the organization has absconded with a sizeable...
-
Locate a consumer products company on the Web and read its company description (so that you get a good understanding of the geographic locations of the company). Pretend that the company is about to...
-
Maria Castigliani is head of the purchasing department of Ambrosiana Merceti, a medium-sized construction company. One morning she walked into the office and said, The main problem in this office is...
-
Clem and Ida have been married for several years, but this year they decided to get divorced. In the divorce decree, Clem agreed to deed his car to Ida and pay Ida $10,000 per year for four years....
-
The population P of a bacterial colony t days after observation begins is modeled by the cubic function P(t) = 1.035t 3 + 103.5t 2 + 6,900t + 230,000 a. Compute and interpret the derivative P'(t). b....
-
Sheryl's Shipping had sales last year of $10,000. The cost of goods sold was $6,500, general and administrative expenses were $1,000, interest expenses were $500, and depreciation was $1,000. The...
-
According to lecture, our visual perception is strongly based on our own life experiences. This makes me wonder, how can we become more aware of our own visual perceptions of the world? Further, what...
-
Why is it difficult to addresses a variety of readers who have different perspectives from those of the writer? What specific actions should you take to lessen or eliminate this issue?
-
BMX Company has one employee. FICA Social Security taxes are 6.2% of the first $137,700 paid to its employee, and FICA Medicare taxes are 1.45% of gross pay. For BMX, its FUTA taxes are 0.6% and SUTA...
Study smarter with the SolutionInn App