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% (2 reviews)
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 balance in the prepaid insurance account, before adjustment at the end of the year, is $21,700. Journalize the adjusting entry required under each of the following alternatives for determining...
-
What is the equation of the estimated trend that has been calculated using the deseasonalized data? International Machinery, Inc., produces a tractor and wishes to use quarterly tractor sales data...
-
On the first day of its fiscal year, Chin Company issued $10,000,000 of five-year, 7% bonds to finance its operations of producing and selling home improvement products. Interest is payable...
-
Data related to the acquisition of timber rights and intangible assets during the current year ended December 31 are as follows: A. Timber rights on a tract of land were purchased for $3,589,500 on...
-
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...
-
Jamaica Corp. (established under the laws of Jamaica) seeks to borrow funds from a Jamaican financial institution. In order to process the loan, the local Jamaican bank requires that U. S. Corp., the...
-
1.For Zenith Co. the Processing Division sells a computer module to the company's Assembly Division, which assembles the finished product.The Microprocessor Division is currently working at capacity....
-
I. The company "EVERYTHING FRESH EXCEPT THE CHICKEN" buys birds to process and distribute them for human consumption. From the process of these birds 3 products "breasts, thighs and wings" are...
-
What is the decimal value of this 8-bit two's complement number? 1000 0000
-
Direct Disk Drive Company operates a computer disk manufacturing plant. Direct materials are added at the end of the process. The following data were for June2017: Work in process, beginning...
-
You are the director of health information management at an acute care hospital. The hospital's radiology manager has come to you because an employee mistakenly included protected health information...
-
In Problem, find f'(x) and find the equation of the line tangent to the graph of f at the indicated value of x. f(x) = eVx; x 1
-
Hardin Services Co. experienced the following events in 2016: 1. Provided services on account. 2. Collected cash for accounts receivable. 3. Attempted to collect an account and, when unsuccessful,...
-
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...
-
Question 7 of 7 0/14 W PIERDERY Current Attempt in Progress Your answer is incorrect Buffalo Corporation adopted the dollar value LIFO retail inventory method on January 1, 2019. At that time the...
-
Cost of debt with fees . Kenny Enterprises will issue a bond with a par value of $1,000, a maturity of twenty years, and a coupon rate of 9.9% with semiannual payments, and will use an investment...
-
Assume that an investment of $100,000 is expected to grow during the next year by 8% with SD 20%, and that the return is normally distributed. Whats the 5% VaR for the investment? A. $24,898 B....
Study smarter with the SolutionInn App