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.
-
You are a new junior accountant at In Focus Corporation, maker of lenses for eyeglasses. Your company sells generic-quality lenses for a moderate price. Your boss, the controller, has given you the...
-
What are the three parts of a make rule?
-
a. Calculate the required rate of return for an asset that has a beta of 1.8, given a risk-free rate of 5% and a market return of 10%. b. If investors have become more risk-averse due to recent...
-
5. A compact car has a maximum acceleration of 4.5 m/s when it only carries the driver. The driver and the car combined, have a total mass of 1250 kg. What is the maximum acceleration after picking...
-
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...
-
Bevin Inc. had the following in 2019: a. What is Bevin Inc.s taxable income in 2019? b. What carrybacks or carryovers does it have from 2019? Gross income from operation Dividends from 22%-owned...
-
There are several classes of stock discussed this week. Describe how each type of stock is different and the stockholders' rights associated with each. Discuss how corporations use stocks to raise...
-
suggest statements of understanding, applying, analyzing, evaluating, and creating for the following: I can process financial data for up to 10 million dollars in revenue sales; Well enough to...
-
The judge knows relatively little about each case. Group of answer choices True False
-
Attempt a fundamental evaluation of Torrington on a standalone basis
-
What are the cost elements in EOQ? Question 5Answer a. Heating costs, obsolescence, and theft b. Shrinkage, gross stock errors, and net stock errors. c. Holding costs and shipping costs d. Shipping...
-
Clean-N-Brite is a multiproduct company with several manufacturing plants. The Cincinnati plant manufactures and distributes two household cleaning and polishing compounds, regular and heavy-duty,...
-
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...
-
Saved If an Invoice Indicates that interest at the rate of 0.68% per month will be charged on overdue amounts, what effective rate of Interest will be charged? (Round your final answer to 2 decimal...
-
Riemer, Incorporated has four departments. Information about these departments is listed below. Maintenance is a service department. If allocated maintenance cost i based on floor space occupied by...
-
A company's balance sheet shows: cash $30,000, accounts receivable $20,000, office equipment $54,000, and accounts payable $21,000. What is the amount of owner's equity?
Study smarter with the SolutionInn App