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]
3 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]3 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
What is NOT an issue associated with tag management systems? There is no automation available for tag management systems. Managi
SSSSS [86.1K]

Answer:

Managing tags means experience with the programming language to utilize them.

Explanation:

In different markets, tags are used to assigned prices and values to different products. To make these tags "tag management systems" are deployed to manage and create these tags.

Tag management system is software, that is used to create the tags with ease. There is no need of coding or programming while creating tags.

<em>So we can say that, There is no issue of Managing tags means experience with the programming language to utilize them.</em>

5 0
3 years ago
In 2011 a program named Watson running on an IBM supercomputer
lora16 [44]

Answer:C)Defeated the two most successful human Jeopardy! champions in a three-game match.

Explanation:  Watson emerged from the IBM supercomputer made by Thomas Watson .It is made from the two main component analytical software and the artificial intelligence which made it a optimal for the question-answer feature.

Watson defeated Ken Jennings and Brad Rutter(earlier successful contestants) in the program named Jeopardy by answering questions correctly and quickly in 2011.Other options are incorrect because it did not worked as the software engineer,humane genome or won crossword puzzle.Thus the correct option is option (c).

8 0
3 years ago
Which range of values would result in 10 elements stored in an array?
Paraphin [41]

Answer:

0-9

Explanation:

count 0 as 1

len(0,1,2,3,4,5,6,7,8,9)=10

3 0
3 years ago
I really need the answer now!!
guajiro [1.7K]

Answer:

3. B.

4. B.

5. B.

6. C.

7. D.

8. C.

9. C.

10. D.

Explanation:

I hope I helped you.

4 0
2 years ago
The sales management team requires that the Lead Source field of the Lead record be populated when a Lead is converted. What wou
Sav [38]

Answer: A. Validation rule

Explanation:

Validation rules can be used to ensure that fields are populated because they can verify if the data being inputted meet the requirements of the administrators by returning a 'True' or 'False' response after testing. If the result is false, the user will be unable to move on until they adjust the field.

For example, Field length checks on websites are a Validation rule where you are only allowed to input a set number of characters and anything less or more will be denied, such as in the case of inputting phone numbers.

By including a Validation Rule that the LeadSource field of the Lead record be populated when a Lead is converted, the developer will be able to make sure that a user populates the Lead Source field prior to converting a Lead.

5 0
3 years ago
Other questions:
  • What is needed to create a good problem statement?
    10·1 answer
  • Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,
    7·1 answer
  • . The first step in devising security services and mechanisms is to develop a security policy True False
    11·1 answer
  • Name the sections of an instruction.
    15·1 answer
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • What allows users to connect via the Internet to its private network?
    11·2 answers
  • Why might a business choose a server-based network over a peer-to-peer network?
    15·1 answer
  • create a function that has an argument is the triple jump distance. It returns the estimate of vertical jump height. The world r
    8·1 answer
  • Your company just installed a new web server within your DMZ. You have been asked to open up the port for secure web browsing on
    5·1 answer
  • Which statement correctly differentiates how to use list and table styles?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!