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
sleet_krkn [62]
3 years ago
13

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 is GR_APPLES, output should be:Fruit#include int main(void) {enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};enum GroceryItem userItem = GR_APPLES;/* Your solution goes here */return 0;}

Computers and Technology
1 answer:
Sloan [31]3 years ago
5 0

Answer:

Here is the complete code

#include <iostream>  //for input output functions

using namespace std;   //to identify objects like cin cout

int main() {  //start of main() function body

  enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};  //enum is used to assign names to constant

  GroceryItem userItem = GR_APPLES;  

//value of userItem is set to GR_APPLES

  /* Your solution goes here  */

//if the userItem is equal to GR_APPLES or GR_BANANAS

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

 cout << "Fruit";  } //display Fruit if above if condition is true

//if the value of userItem is equal to GR_JUICE or GR_WATER

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

 cout << "Drink";  } //display Drink if the above if condition is true

else{  //if none of the above if conditions is true then print Unknown

 cout << "Unknown";  }  

cout << endl;

  return 0;  }

Explanation:

The output of the program is Fruit because the value of userItem is set to GR_APPLES and according to the if statement if the userItem is equal to GR_APPLES than "Fruit" will be displayed on the screen as output.

The program along with its output is attached as a screen shot.

You might be interested in
Analyze the following code. Is count &lt; 100 always true, always false, or sometimes true or sometimes false at Point A, Point
GaryK [48]

Answer:

Point A: Always True

Point B: Sometimes false

Point C: Always False

Explanation:

In the given code snippet. Point A is the first statement within the While loop the statement System.out.println("Welcome to Java!"); will only be executed if the while condition evaluates to true.

At Point B, The statement count++ increases the value of the counter at every iteration, while it will be true for most occasions, at the last increament, this statement will be false that is at count=100, The condition will be false at this point just before program execution breaks out of the loop

Point C is outside of the loop, this happens when the given condition is no longer true.

8 0
3 years ago
Suppose that the format for license plates in a certain state is two letters followed by four numbers. (a) How many different pl
Ymorist [56]

Answer:

(a) 6,760,000 plates

(b) 3,407,040 plates

(c) 6,084,000 plates

Explanation:

The very first thing to note about this question is the number of characters involved in the license plate format (6 characters in this case; 2 letters and 4 numbers). The letters come first and then the numbers follow.

There are a total of 26 possible letters (A-Z) and 10 possible numbers (0 - 9) that can be chosen. We can then proceed to the first question;

(a) Here, the total number of possible plates is to be determined. This is done as follows:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 10 possible numbers

So, total number of different plates will be obtained by multiplying all the possibilities: 26 × 26 × 10 × 10 × 10 × 10 = 6,760,000 plates

(b) This second part puts a constraint on the usage of the numbers, unlike the question (a), where there was no constraint at all.

Since there is no constraint on the letters, we can write that:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

For the first number as well, we can write:

Character 3 (number): There are 10 possible numbers

However, for the remaining characters, the possibilities will continually reduce by a value of 1, since we can not use a number that has been used before. So,

Character 4 (number): There are 9 possible numbers

Character 5 (number): There are 8 possible numbers

Character 6 (number): There are 7 possible numbers

So, total number of different plates will be: 26 × 26 × 10 × 9 × 8 × 7 = 3,407,040 plates

(c) Here, repetitions are allowed as in questions (a), but there can not be four zeros. This implies that the maximum number of zeros in any plate will be three. Thus, there will be maximum possibilities on all characters until the last one which will be constrained.

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 9 possible numbers

Total number of plates will therefore be: 26 × 26 × 10 × 10 × 10 × 9 = 6,084,000 plates.

7 0
3 years ago
In a system where Round Robin is used for CPU scheduling, the following is TRUE when a process cannot finish its computation dur
masha68 [24]

Answer:

B. The process will be terminated by the operating system.

Explanation:

When Round Robin is used for CPU scheduling, a time scheduler which is a component of the operating system is used in regulating the operation. A time limit is set for each of the processes to be run.

So, when a process fails to complete running before its time elapses, the time scheduler would log it off and return it to the queue. This queue is in a circular form and gives each of the processes a chance to run its course.

7 0
2 years ago
40 POINTS I NEED THESE ANSWERS ASAP GIVE ME THE RIGHT ASNWER AND ILL PUT YOU AS THE BRAINLIEST
Law Incorporation [45]
Having a filling system and keeping a clean desk is good time management tips (True)

Your wrists should be low,relaxed and resting on the frame of the keyboard while typing (False)

A correctly formatted memo will have a complimentary closing? (False)

Which professional business memo part is keyed first?
D.) TO

to type a capital letter "T" the typist will hold the right shift key with the right little finger, and then strike "t" with the left pointer (first) finger. (True)

in a standard block style letter, key the date to print ___ from the top edge of the page
D.) Double space (DS)

A search engine can help link you to information on how to format a buisness letter. (True)
7 0
3 years ago
Which of the following is not an Operating System? (1 point)Windows
kobusy [5.1K]
The answers of the following are:

1.  The answer is Linux. It is not an Operating System.
2. Windows XP 2000 and Windows XP Home Edition have the same interface design. 
3. Linux is the operating systems which is considered to be open source.
4. Mac OS is an operating system which is considered to be the most popular with graphic and multimedia designers
5. The software programis the number and variety of programs available for a particular operating system.
4 0
3 years ago
Other questions:
  • Retail price data for n = 60 hard disk drives were recently reported in a computer magazine. Three variables were recorded for e
    13·1 answer
  • Write a program that displays in the title of the window the position of the mouse as the user moves the mouse around the window
    5·1 answer
  • FTP requires confirmation that a file was successfully transmitted to a client, but it has no built-in mechanism to track this i
    7·2 answers
  • What does PowerPoint display when you use the Notes Page view?
    14·2 answers
  • Please hurry Arrange the steps of the engineering design process in the correct sequence.
    10·1 answer
  • Able to make a survey form using VB (Visual basics 6.0) to represent ways of conservation of
    8·2 answers
  • Where is information stored in the computer?​
    9·1 answer
  • As Jane was setting up her projector, she realized that the images on the screen appeared blurred. How would Jane sort out the i
    6·2 answers
  • Who is the king of computers?
    8·2 answers
  • Sorry, I cant tell you, you need to know
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!