Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Creat& a console app called CollectLobsterSizes that continuously prompts the user to enter sizes of lobsters (in inches) until the sentinel value of -1 is

Creat& a console app called CollectLobsterSizes that continuously prompts the user to enter sizes of lobsters (in inches) until the sentinel value of -1 is entered. You must use a loop to get these lobster sizes from the user. As you get each lobster size, count it and accumulate it. In other words, use a counter variable and add 1 to it each time you get a lobster value. Similarly, use an accumulator variable and add each lobster size to it as you get it. After the loop is done, output the number of lobster sizes collected, the sum of lobster sizes, and the average lobster size (in inches). Turn in output showing that you collected sizes for at least five lobsters.

Make sure your loop is structured (refer to the priming read or priming input that we learned about in COP 1000).

Your average should use a variable of some type other than int (since averages usually have a fractional part, for example, 35.78).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions