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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 program that allows a user to enter the type of ice cream sold.
• 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

Note: when using fgets:
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

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
Transcribed Image Text: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
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education