1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kupik [55]
4 years ago
15

Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followe

d by a newline) if the value of userItem does not match any of the defined options. For example, if userItem = GR_APPLES, output should be:FruitSample program:#include using namespace std;int main() { enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER}; GroceryItem userItem = GR_APPLES; return 0;}Below, do not type an entire program. Only type the portion indicated by the above instructions (and if a sample program is shown above, only type the portion.)

Computers and Technology
1 answer:
vagabundo [1.1K]4 years ago
7 0

Answer:

I am writing a C++ program. Let me know if you want the program in some other programming language. Here is the portion of the code:

if((userItem == GR_APPLES) || (userItem == GR_BANANAS)){

 cout << "Fruit";   }

else if((userItem == GR_JUICE) || (userItem == GR_WATER)){

 cout << "Drink";  }

else{

 cout << "Unknown";  }  

cout << endl;

 

Explanation:

The IF statement is used to check the defined options with the value in the userItem.

If the value of the userItem is GR_APPLES OR GR_BANANAS then Fruit is printed as the output. || represents a logical operator OR so this means that userItem can be either the GR_APPLES or GR_BANANAS for the If condition to evaluate to true.

If the above condition evaluates to false then the else-if part will be checked next. So the else if checks if the value in the userItem is GR_JUICE or GR_WATER. If userItem contains either of these two then Drink is displayed on the screen as output.

If the else-if statement also evaluates to false then the else part is executed which displays Unknown.

The cout<< endl; statement in the last is used to print the new line. For example if the output is Unknown then it is followed by a new line.

In the given program userItem is set to GR_APPLES

GroceryItem userItem = GR_APPLES

So the output of the whole program is Fruit followed by a new line.

The screenshot of the code along with the output is attached.

You might be interested in
The pseudo-class selectors for links let you use CSS to change the formatting for all but one of the following. Which one is it?
aev [14]
B. A link that is inactive
7 0
3 years ago
Which of the following is a new feature in Windows Server 2016 that enables block-level data replication to occur automatically
Inessa [10]

Answer:

Option C is the correct answer for the above question

Explanation:

  • The storage replica is a new advantage that is used in the 2016 version of the windows server. It is a feature which is very useful for the user point of view, because of it more secure the data transfer on the internet.
  • It is used to block the duplicate data, by which the storage space is left for the other data and the data will secure when it stores on the server.
  • The above question asked about the features which are a new advantage of the 2016 version and provide block facilities for the duplicate data which is storage Replica which is defined above.
  • Hence the correct option is C, while the other is not because others is not a feature to block the duplicate data.
7 0
3 years ago
Entering the formula =SUM(C5:C18), in cell C19 will result in which of the following?
Greeley [361]
I am not sure what the 'following's are
but it should result the sum of all cells between and including C5 and C18.

5 0
3 years ago
How can e-group help in collaborating online​
tresset_1 [31]

Answer:

Collaborative learning is an e-learning approach where students are able to socially interact with other students, as well as instructors. ... Collaborative learning is based upon the principle that students can enrich their learning experiences by interacting with others and benefiting from one another's strengths.

Explanation:

inclusion of collaborative activities in an online course leads to positive student performance outcomes. Collaborative group interactions facilitate active learning, shared knowledge, and promote social interaction and a supportive eLearning community

4 0
3 years ago
Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?
Sloan [31]

Answer:

The last one

Explanation I think it is D because all of the other answers are saying what happen if you filter it.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following software costs money?
    6·2 answers
  • Which acronym describes technology in which all or most of a deviceâs electronic circuitry is on a single microchip?
    12·1 answer
  • ​______________________ is a general security term that includes computer​ viruses, worms, and trojan horses.
    13·1 answer
  • which of the following is not a windows accessory? a. sticky notes b. windows 8 c. sound recorder or d. paint
    8·2 answers
  • What is information associated with a document to help describe that document called?
    14·1 answer
  • Which can be used to decode a Unicode character encoding into text?
    13·1 answer
  • . Write a C++ Code to get a multiline statement Str1 from a user with a ‘$’ as return character (Hint:
    6·1 answer
  • Ple Choice Worth 5 points)
    11·1 answer
  • Please help me please i’ll give brainli
    12·1 answer
  • Digital rights include the right to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!