Question

CHALLENGE 4.12.1: Enumerations: Grocery items. ACTIVITY Print either Fruit, Drink, or Unknown (followed by a newline) d
Ay b0sS why dis is not working I am scientist but it don't work so I don't feel like scientist anymore and now I depressed please help me be happy. Thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You are using switch-case statements incorrectly.

Since we are comparing userItem, in case statements we just have to put different case values of GroceryItem like GR_APPLES, GR_BANANAS, etc.

Below is the fix:

enum GroceryItem GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER }; enum GroceryItem userItem; userItem GR_APPLES; switch (userItem

Below is the output produced by the code:

Fruit

This completes the requirement. Let me know if you have any queries.

Thanks!

Add a comment
Know the answer?
Add Answer to:
Ay b0sS why dis is not working I am scientist but it don't work so I...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT