1

Ay b0sS why dis is not working I am scientist but it don't work so I...

Question

Ay b0sS why dis is not working I am scientist but it don't work so I...

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

CHALLENGE 4.12.1: Enumerations: Grocery items. ACTIVITY Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userltem. Print "Unknown" (followed by a newline) if the value of userltem does not match any of the defined options. For example, if userltem is GR_APPLES, output should be Fruit 1 #include <stdio.h> int main(void) 1 test passed Item GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER} ; enum Grocery Item userItem 6 userItem GR_APPLES; 7 All tests passed switch (Grocery 10 case 1 GR_APPLES "Fruit" ); break: 13 14 case 2 GR BANANAS printf("Fruit"); 15 16 17 break; 18 19 case 3 GR JUICE: printf("Drink"); break; 20 21 Run

Answers

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!


Similar Solved Questions

1 answers
Maher Corporation, which has only one product, has provided the following data concerning its most recent...
Maher Corporation, which has only one product, has provided the following data concerning its most recent month of operations: Selling price $ 168 Units in beginning inventory 0 Units produced 3,580 Units sold 3,120 Units in ending inventory 460 Variable costs per uni...
1 answers
When the low tire pressure light came on, the pressure was low because of the temperature...
When the low tire pressure light came on, the pressure was low because of the temperature that was low. What can you infer about the volume and moles of gas within the tire?...
1 answers
Riverbed Company received the following selected information from its pension plan trustee concerning the operation of...
Riverbed Company received the following selected information from its pension plan trustee concerning the operation of the company’s defined benefit pension plan for the year ended December 31, 2017. January 1, 2017 December 31, 2017 Projected benefit obligation $1,523,000 $1,550...
1 answers
Describe a national or a local non-governmental organization that promotes health and wellness for a culturally...
Describe a national or a local non-governmental organization that promotes health and wellness for a culturally diverse population. Identify the population in your post....
1 answers
Unpolarized light of average intensity 50 w/m^2 is passed through a vertical polarizer. It then passes...
Unpolarized light of average intensity 50 w/m^2 is passed through a vertical polarizer. It then passes through an analyzer, emerging with an average intensity of 22 w/m^2. what is the angle of the analyzer with the vertical?...
1 answers
1. The information below is from a box of typhoid vaccine. VIVOTIF BERNA® Typhoid Vaccine Oral...
1. The information below is from a box of typhoid vaccine. VIVOTIF BERNA® Typhoid Vaccine Oral Ty 21a Explain how you would know by simply reading this label that this is an attenuated vaccine. (Hint: Vivo means "life" in Latin and the little “a” does stand for attenuated, bu...
1 answers
Please do it as early as possible. thank you Part 2. Drafting Letter Read the following...
please do it as early as possible. thank you Part 2. Drafting Letter Read the following onse study carefully, and develop a document as required. Plan the content according to the principles covered in in the course (c.g., main idea first). Draft your document and proofread the text in detail. Give...
1 answers
Find the local maximum and minimum values and saddle points) of the function. If you have...
Find the local maximum and minimum values and saddle points) of the function. If you have three-dimensional graphing software, graph the function with a domain and viewpoint that reveal the important aspects of the separated it. If an awer does not exister DHE) RX- 6 - 2x + 4y - 4 local maximum valu...
1 answers
(C++) Write the statement to read and consume one character stored in the cin object.
(C++) Write the statement to read and consume one character stored in the cin object....
1 answers
Determine the vapor pressure in psi of a substance at 83.9 Celsius if its normal boiling...
determine the vapor pressure in psi of a substance at 83.9 Celsius if its normal boiling point is 102 Celsius and its enthalpy of vaporization is 66.2 kJ/mol. 1 atm = 14.7 psi thank you!...
1 answers
What are the leading causes of death for the following groups? Adolescents and young adults? Adults?...
What are the leading causes of death for the following groups? Adolescents and young adults? Adults? Exemplify and elaborate on root cause, prevention and community programs....
1 answers
Do we reject or do not reject? is there a difference in the two populations? At...
Do we reject or do not reject? is there a difference in the two populations? At the .10 significance level can we conclude that there is a difference in the variation of sick days of men vs. women? 21 men took on average 10 sick days with a standard deviation of 4 days. 21 women took on average 12 s...
1 answers
Most nonsense mutations in a structural gene for a protein have a null phenotype. How many...
Most nonsense mutations in a structural gene for a protein have a null phenotype. How many different single base substitution mutations in a protein coding sequence can produce a nonsense mutation?...
1 answers
Can anyone explain this: H2O and acetone are miscible, acetone and hexane are miscible, but water...
Can anyone explain this: H2O and acetone are miscible, acetone and hexane are miscible, but water and hexane are immiscible...
1 answers
What composition of the lead-free alloy in the Sn-Bi system likely to have maximum tensile strength?...
What composition of the lead-free alloy in the Sn-Bi system likely to have maximum tensile strength? 21 % bismuth 60% bismuth 30% bismuth None of the above Please explain your reasoning....
1 answers
Magnesium reacts with oxygen gas to produce magnesium oxide, light, and heat. This reaction is Select...
Magnesium reacts with oxygen gas to produce magnesium oxide, light, and heat. This reaction is Select one: O A. a combination reaction OB. a single replacement reaction O C. a catalysis reaction OD. a decomposition reaction O E. a double replacement reaction What is the mass percent of carbon in met...
1 answers
What steps might you take if a program evaluation resulted unfavorably?
What steps might you take if a program evaluation resulted unfavorably?...
1 answers
Please write the problem step by step. Thank you!
Please write the problem step by step. Thank you!...

-- 0.011126--