Enter ice cream flavor #1: vanilla Enter ice cream flavor #2: chocolate Enter ice cream flavor #3: mint Enter ice cream flavor #4: strawberry Enter corner 1 sales of vanilla 11.5 Enter corner 1 sales of chocolate 15.75 Enter corner 1 sales of mint 22 Enter corner 1 sales of strawberry 7.25 Enter corner 2 sales of vanilla 12.75 Enter corner 2 sales of chocolate 9.25 Enter corner 2 sales of mint 16.5 Enter corner 2 sales of strawberry 21 Total vanilla sales: 24.25 Total chocolate sales: 25.00 Total mint sales: 38.50 Total strawberry sales: 28.25 Bob's Ice Cream total sales: 116.00
Bob’s Ice Cream sells four types of ice cream: vanilla, chocolate, mint, and strawberry.
• Bob's Ice Cream sells ice cream from trucks that are parked at two different corners.
They sold {$11.5, $15.75, $22, $7.25} on Saturday and {$12.75, $9.25, $16.5, $21} on
Sunday [note sales are in vanilla, chocolate, mint, and strawberry order].
• Create an enum for flavors:
enum flavors {vanilla, chocolate, mint, strawberry};
• Create a C
• Create a C program that allows a user to enter the sales data.
• Load two one-dimensional arrays with Bob’s entered sales data. Only index your arrays
using an enum variable (enum flavors index = vanilla; corner1Sales[index] = 11.5;)
• Sum the contents of the flavors in the arrays together.
• Print out the resulting flavors and their sum with Bob's total sales
1. you'll need to make the array that holds your
string +2 in size. You have to have room for
the final /n and the final /0.
2. Your fgets max size has to account for the two
additional characters: max string size + 2.
output should be look similar to the picture, and please with comment for the code.
output sample below:
Enter ice cream flaver #1: vanilla
Enter ice cream flaver #2: chocolate
Enter ice cream flaver #3: mint
Enter ice cream flaver #4: strawberry
Enter corner 1 sales of vanilla: 22
Enter corner 1 sales of chocolate: 44
Enter corner 1 sales of mint: 66
Enter corner 1 sales of strawberry: 33
Enter corner 2 sales of vanilla: 33
Enter corner 2 sales of chocolate: 55
Enter corner 2 sales of mint: 22
Enter corner 2 sales of strawberry: 44
Total vanilla sales: 55.00
Total chocolate sales: 99.00
Total mint sales: 88.00
Total strawberry sales: 77.00
Bob's Ice Cream total sales: 319.00
Unlock instant AI solutions
Tap the button
to generate a solution