Write a loop that reads strings from standard input where the string is either land, air,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates when "xxxxx" (five x characters) is read in. Other strings are ignored. After the loop, your code should print out 3 lines: the first consisting of the string "land:" followed by the number of "land" strings read in, the second consisting of the string "air:" followed by the number of "air" strings read in, and the third consisting of the string "water:" followed by the number of "water" strings read in. Each of these should be printed on a separate line. Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates when "xxxxx" (five x characters) is read in. Other strings are ignored. After the loop, your code should print out 3 lines: the first consisting of the string "land:" followed by the number of "land" strings read in, the second consisting of the string "air:" followed by the number of "air" strings read in, and the third consisting of the string "water:" followed by the number of "water" strings read in. Each of these should be printed on a separate line.
Expert Answer:
Answer rating: 100% (QA)
Loop to read strings from standard input and counting the occurrences o... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Make a list of all of the support services (for example: housekeeping, security, dietary services) required in your work setting or setting of interest. Estimate the annual costs of each of these...
-
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...
-
Windy City Company has the following information pertaining to its Brick Division for this year: Bricks Fixed manufacturing expenses $ 70,000 Fixed selling and administrative expenses 60,000 Sales...
-
True or False The slope of the line 2y = 3x + 5 is 3.
-
Suppose X has a Poisson distribution with a mean 0.4. Determine the following probabilities: (a) P(X = 0) (b) P(X < 2) (c) P(X = 4) (d) P(X = 8)
-
The temperature near the surface of the earth is 291 K. A xenon atom (atomic mass 5 131.29 u) has a kinetic energy equal to the average translational kinetic energy and is moving straight up. If the...
-
The pressure at section (2) shown in Fig. P8.66 is not to fall below 60 psi when the flowrate from the tank varies from 0 to \(1.0 \mathrm{cfs}\) and the branch line is shut off. Determine the...
-
Barker, Inc. manufactures tire tubes in a two-stage process that includes assembly and sealing. The Sealing Department tests the tubes and adds a puncture-resistant coating to each tube to prevent...
-
I deposit money into an ordinary annuity that earns 4.8% interest, compounded monthly. How much money do I need to deposit into the annuity every month to have a final value of 73,000 in 16 years?
-
You are trying to evaluate whether an existing, idle distillation column can be used for a separation for which it was not originally designed. Answer the following questions about this column: a....
-
Bob Sample and other student investors opened Campus Laundromat Inc. on September 1, 2011. During the first month of operations the following transactions occurred. Sept. 1 Shareholders invested...
-
Suppose you need to buy 6 tons of Italian olives in 6 months for a fixed price contract (your sales quote is in USD). 6 tons of Italian olives currently costs 80,000euro. The current exchange rate is...
-
What is Gross Domestic Product? Why GDP is important?
-
A deposit of $ 5 0 0 made five years ago is worth $ 7 0 5 . 3 0 today. The deposit pays interest semi - annually. What is the interest rate? How much would you have had to invest 2 1 years ago in an...
-
What will the value of your investment account be at the end of year 2 5 if you invest 2 5 0 0 0 in year 1 $ 3 5 0 0 0 in year 2 and 5 0 0 0 0 in year 5 and expect to earn 1 1 % annually. Asume each...
-
For a 3 0 - year mortgage - backed security with a $ 1 , 0 0 0 , 0 0 0 current face amount, a 7 . 5 0 % gross coupon, and a 3 6 0 month remaining term to maturity, what would be the projected...
-
What will Iran's population be in 2050?
-
Give the structural formulas of the alkenes that, on ozonolysis, give: a. (CH3)2C=O and CH2=O b. Only (CH3CH2)2C=O c. CH3CH=O and CH3CH2CH=O d. O=CHCH2CH2CH2CH=O
-
Write four different C# statements that each add 1 to int variable x.
-
Based on the dangling-else discussion in Exercise ANS: , modify the given code to produce the output shown in each part of the problem. Use proper indentation techniques. You must not make any...
-
Fill in the blanks in each of the following statements: a) The public members of a class are also known as the classs ________or ________. b) If a method contains a local variable with the same name...
-
Dunkirk Consulting wishes to predict the amount of overhead expense that will be incurred by a consulting contract, to develop more accurate bids for future con- tracts. Dunkirk has the following...
-
Block Commodities has gathered the following information concerning rock salt deliveries to its clients, which it believes are highly seasonal: a. Suppose Block Commodities calculated a set of...
-
The service center at a large automobile dealership is trying to boost revenue by pro- viding no-appointment-necessary oil changes to any type of vehicle that stops by the service center. To quickly...
Study smarter with the SolutionInn App