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
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