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
zaharov [31]
3 years ago
5

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:
Computers and Technology
2 answers:
kenny6666 [7]3 years ago
5 0
According to your syntax, I am pretty sure that this one is C++ question. I think that your solution looks like this:
So if useritem is gr_apples, output should be "Fruit".
int main() {   enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};
   GroceryItem userItem = GR_APPLES; if((userItem == GR_APPLES) || (userItem == GR_BANANAS)){ cout << "Fruit"; } else if((userItem == GR_JUICE) || (userItem == GR_WATER)){ cout << "Drink"; } else{ cout << "Unknown"; }
cout << endl;   return 0;}
BartSMP [9]3 years ago
5 0

The given problem can be solved using loops. Compare the user items with given grocery items and print the result whether it is "Fruit", "Drink", or "Unknown".  Here,  enum data structure is used to store the grocery items and if- else loop is used to categorize the grocery items.

Further Explanation:

Code:

The complete C++ code for the given problem is as shown below:

#include <iostream>

using namespace std;

/*Print either "Fruit", "Drink", or "Unknown" depending on the inputs*/

int main() {

enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};

GroceryItem userItem = GR_APPLES;

/* The solution goes here  */

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

cout << "Fruit";

}

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

cout << "Drink";

}

else{

cout << "Unknown";

}

cout << endl;

return 0;

}

Output:

Run the program, the output will be look like as below:

Testing with userItem = GR_APPLES

Your output: Fruit

Testing with userItem = GR_JUICE

Your output: Drink

Testing with userItem = 5

Your output: Unknown

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. How does coding work on computers?  brainly.com/question/2257971 

Answer details:

Grade: College Engineering

Subject: Computer Science

Chapter: C++  Programming

Keyword:

C++, input, output, programming, statements,  loops, if, else, statements, newline, useritem, drink, fruits, return 0

You might be interested in
Zoom meeting ID:987 6858 5587 Password:196133
Llana [10]
I might join I’m not sure tho is there gonna be a lot of ppl?
3 0
3 years ago
Read 2 more answers
How do operating system work?
SIZIF [17.4K]

Answer:

The "operating system" manages software and hardware on the computer. Uploads files, has great memory and processes management.

7 0
3 years ago
A continuous and differentiable function f(x) with the following properties: f(x) is decreasing at x=−5 f(x) has a local minimum
butalik [34]

The continuous and differentiable function where f(x) is decreasing at x = −5 f(x) has a local minimum at x = −2 f(x) has a local maximum at x = 2 is given as: y = 9x - (1/3)x³ + 3.

<h3>What is a continuous and differentiable function?</h3>

The continuous function differs from the differentiable function in that the curve obtained is a single unbroken curve in the continuous function.

In contrast, if a function has a derivative, it is said to be differentiable.

<h3>What is the solution to the problem above?</h3>

It is important to note that a function is differentiable when x is set to a if the function is continuous when x = a.

Given the parameters, we state that

f'(5) < 0; and

x = -5

The local minimum is given as:
x = -3;

the local maximum is given as

x = 3

Thus, x = -3 ; alternatively,

x = 3.  With this scenario, we can equate both to zero.

Hence,

x + 3 = 0;

3-x = 0.

To get y' we must multiply both equations to get:

y' = (3-x)(x + 3)

y'   = 3x + 9 - x² - 3x

Collect like terms to derive:

y' = 3x - 3x + 9 - x²; thus

y' = 9-x²

When y' is integrated, the result is

y = 9x - (x³/3) + c

Recall that

F (-5) < 0

This means that:

9 x -5 - (-5³/3) + c < 0
⇒ -45 + 125/3 + c <0
⇒ -10/3 + c < 0

Collecting like terms we have:
c < 10/3; and

c < 3.33


Substituting C into

f(x) = 9x - x³/3 + c; we have

f(x) = 9x - x³/3 + 3, which is the same as  y = 9x - (1/3)x³ + 3.

Learn more about differentiable functions at:
brainly.com/question/15047295
#SPJ1

7 0
2 years ago
PLEASE HELP ON THESE 3!! ILL GIVE A BRAINLIEST IF ITS CORRECT!!
Travka [436]
Not entirely sure about 1; I believe it's D. 2 is C, and 3 is A.
5 0
4 years ago
1. Our Systems are Microsoft Dynamics OLTP, we move data from the Source Systems through Staging to a Data Warehouse. Our report
zmey [24]

Answer:

1. More access to data

2.convenience

3. Easy creation of BI solutions

4. Report creation

5. Saves time

Explanation:

A data warehouse can be described to be an electronic storage system that contains large amount of facts and information which sources for and also maintains data from different sources; either external or internal.

The most important reason for a data warehouse is for it to store great amounts of data to be used for query and also to be used for analysis.

Why do we use a data warehouse?

1. Users have more access to data due to the integration of various sources of data. It makes use of real time data facts

2. You can conveniently store and also create metadata

3. Business intelligence solutions can easily be created using data warehouses.

4. Users can easily create their own reports

5. Data warehouses makes accessing different data sets faster. It is a time saver as business users are not going to spend time trying to retrieve data from various sources.

4 0
3 years ago
Other questions:
  • GenXTech is a growing company that develops gaming applications for military simulations and commercial clients. As part of its
    9·1 answer
  • Which type of hypervisor does not run on an underlying operating system?
    13·1 answer
  • When using correct ergonomic technique be sure to
    6·2 answers
  • The algorithm ____ is used to find the elements in one range of elements that do not appear in another range of elements.
    5·1 answer
  • The repeated use of electronic communications, such as chat rooms and email, to seek out, harass, or frighten someone is called
    12·1 answer
  • What are advantages of using document templates?
    13·2 answers
  • What is the relationship between agile teams and project requirements
    9·1 answer
  • I found a brand-new charger wire still in its plastic package, but it's six years old and has never been used. Is it safe to use
    9·1 answer
  • Your organization has 20 employees who need an accounting software update installed. Due to a miscommunication, the purchaser on
    6·1 answer
  • True or false: if you are adding your own css sheet, make sure your css file comes before the bootstrap css file.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!