# Homework Solution: Loop termination by user-query method-flowchart Draw a flowchart that calculates and prints the total cost for a ser…

Loop termination by user-query method-flowchart Draw a flowchart that calculates and prints the total cost for a series of purchases. Use a loop to repeatedly ask the user to enter the price and quantity of items purchased. Within the loop accumulate the total cost of the purchases so far. The algorithm should generate a display of prompts, inputs, and final output that looks like this: Sample session: Do you want to calculate total purchase cost? (y/n): y Enter price: 10.55 Enter quantity: 1 Do you want to continue? (y/n): y Enter price: 20.00 Enter quantity: 2 Do you want to continue? (y/n): n Total cost = \$50.55 Loop termination by user-query method-pseudocode Provide a solution to the previous problem in the form of pseudocode. Loop termination by sentinel-value method Write a pseudocode algorithm that calculates and print the total cost for a series of purchase. Use a loop to repeatedly ask the user to enter the price and quantity of items purchased. Within the loop, accumulate the total cost for a series of purchases. Use a loop to total cost of the purchases so far. Use a negative number for a sentinel value. More specifically, when the user enters a negative number for the price, the loop should terminate. The algorithm should generate a display of prompts, inputs, and final output that looks like this: Sample session: Enter price (negative number to quit): 5.00 Enter quantity: 3 Enter price (negative number to quit): -3 Total cost = \$15