Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with question number 3 using the sentinel value loop. Please stick to the sample session when doing it, because if we do not

image text in transcribed

image text in transcribed

Please help with question number 3 using the sentinel value loop. Please stick to the sample session when doing it, because if we do not we will lose points. I have tried to do this, but i have been having problems.. I provided a screenshot of an example of the sentinel value loop from the text. Thanks

(2) Microsoft Word non commercial use File Home InsertPege Layout ReferencesMailings Review View Cut Copy Format Painter Find Replace Paste, ! x x' . . : -.-. . H. Emphasis Heading 1 Heading 3 rNore al Strang Subtitle TTitle n No Spac Suttle Em Intense E Quote Change StylesSelect Edting Cipboared Font Paragraph Styles 3. Loop termination by sentinel-value method Paste All Write a pseudocode algorithm that calculates and prints the total cost for a series of purchases. Use a loop to repeatedly ask the user to enterthe price and quantity of itemspurchased. Within theloop, accumlate the total costof the purchases so far. Use a negative number for a sentinel value. More specifically, when the user enters a negative numberfor theprice, the loop shouldteminate. The algorithm should generate a display of prompts, inputs, and clck an item to paste ow.. that final output that looks like this: Enter price (negative number to quit): 5.00 Enter quantity: 3 Enter price (negative number to quit): 3 Total cost $15 Options. Page 2 ot 3 Words: 619 9:27 PM 2/13/2019 Figure 2.12 illustrates the algorithm solution for this problem. Note how the prompt messages say "(-1 to quit)." That is necessary because without it, the user wouldn't know how to quit. In general, always pro- vide enough prompting information so that the user knows what to do next and knows how to quit. totalScore-O count 0 print "Enter score (1 to quit):" nput score while score! totalScore

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_2

Step: 3

blur-text-image_3

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

=+3. How could you extend the campaign creatively?

Answered: 1 week ago