String inputWord is read from input and integer sumCounts is initialized with 0. Write a while loop that iterates until inputWord is equal to “End”. In each iteration of the loop:

Homework Help: Questions and Answers: String inputWord is read from input and integer sumCounts is initialized with 0. Write a while loop that iterates until inputWord is equal to “End”. In each iteration of the loop:

String inputWord is read from input and integer sumCounts is initialized with 0. Write a while loop that iterates until inputWord is equal to "End". In each iteration of the loop:Read integer furnitureCount from input.
Increase sumcounts by the value of furnitureCount.
Output the value of inputWord, followed by a newline.
Read string inputWord from input.Example: If the input is Wardrobe 37 Cupboard 1 Cabinet 8 End, then the output is:Wardrobe
Cupboard
Cabinet
46 items
  • Read integer furnitureCount from input.
  • Increase sumcounts by the value of furnitureCount.
  • Output the value of inputWord, followed by a newline.
  • Read string inputWord from input.

Example: If the input is Wardrobe 37 Cupboard 1 Cabinet 8 End, then the output is:

Wardrobe
Cupboard
Cabinet
46 items

Answer:

Let’s write the code in C++ step by step, first we

  1. Initialize variables
  2. Set up the while loop
  3. Inside the loop: a. Read furnitureCount b. Update sumCounts c. Output inputWord d. Read next inputWord
  4. After the loop, output the total count

C++ Code

Explanation:

  1. The program starts by reading inputWord from the input.
  2. It enters a while loop that runs until inputWord is equal to "End".
  3. Inside the loop:
    • It reads the integer value furnitureCount.
    • Adds furnitureCount to sumCounts.
    • Prints the value of inputWord followed by a newline.
    • Reads the next inputWord.
  4. After the loop ends (when "End" is encountered), it prints the total count of furniture items.

Example:

If the input is:

Wardrobe 37 Cupboard 1 Cabinet 8 End

The output will be:

Wardrobe
Cupboard
Cabinet
46 items

Learn More: Homework Help

Q. In Finder, if you have a file selected and want to select additional files singly, which modifier key should you hold?

Q. A type of technology that can be attached to a tag and used to identify postal packages is a(n)?

Q. Riley, Brian, and Amanda are all part of the same coding class. The professor assigned a coding project where students had two weeks to come up with their own code. No collaboration was allowed. When grading, the professor noticed the similarities when he ran the Moss analysis. Amanda and Brian’s code were a 94% match and both matched 72% of Riley’s code. The professor said there were no other close analyses in the class.

Q. When I attach a file to my e-mail, will SMTP send it to the e-mail server?

Q. Q. In order to avoid the dangers of social media and get the most out of your online experience, you should:

Q. Which of the following statements best describes the permanency of online activity?

Q. Smart home voice assistants and non-computer devices that can access the internet are known as

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

    Comments