Question: Create a Flowgorithm flowchart from the following C program below: #include float calculateTotal(float prices[], int numItems); float applyTax(float total); int main() { char welcomeMessage[] =

Create a Flowgorithm flowchart from the following C program below:

#include

float calculateTotal(float prices[], int numItems); float applyTax(float total);

int main() { char welcomeMessage[] = "Welcome to Hansen's Discount Supermarket!"; puts(welcomeMessage);

int numItems; printf("How many items do you have to scan: "); scanf("%d", &numItems);

float prices[numItems]; printf("We are sorry the scanner is broke at the moment. Please enter your prices manually. ");

for (int i = 0; i < numItems; i++) { printf("What is the price of your product: "); scanf("%f", &prices[i]);

while (prices[i] > 10.00) { printf("Invalid Price, Be sure to enter a Price under $10.00 "); printf("Enter a valid price: "); scanf("%f", &prices[i]); } }

float total = calculateTotal(prices, numItems); float grandTotal = applyTax(total);

printf("Your total is: %.2f ", total); printf("Tax: %.2f ", grandTotal - total); printf("Your Grand Total including Tax is: %.2f ", grandTotal); printf("Have a great day! ");

return 0; }

float calculateTotal(float prices[], int numItems) { float total = 0.0; for (int i = 0; i < numItems; i++) { total += prices[i]; } return total; }

float applyTax(float total) { float tax = total * 0.06; return total + tax; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!