Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started