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
5. How is shutter speed generally measured? What do the measurements mean?
Leokris [45]
Shutter speed<span> is </span>generally measured<span> by the scientific symbol “s”. The </span>measurement means<span> that the </span>measurements<span> in "s" is the reciprocal of the number when the denominator is put on the numerator side instead. ... Aperture is </span>measured<span> by f's.</span>
6 0
3 years ago
Read 2 more answers
Non-delivered goods, counterfeit products, fraudulent payments are common type of cyber crime these
Arisa [49]

Answer:

a. Internet auction fraud

b. Counterfeit products are products made and/or sold under the brand name of a product of a higher quality

c. 1) Monitor business transactions

2) Use an Address Verification System AVS

Explanation:

a. Such types of cyber crimes are collectively called Internet auction fraud

Internet or online auction fraud is a form of fraud that involves the act of providing misleading information about goods paced on advert for sale on an online auction site, including the sale of counterfeit goods, sale of goods of poor quality, receiving a different item from what was ordered, artificial bidding to increase price, omission of important information about a product, delivering an item that looks different from what was displayed on the website and the non-delivery of an item already to the buyer.

A seller can be a victim of the internet auction fraud when a buyer does not pay for goods an/or services received, request for delivery before payment, the buyer pays with a stolen credit card, the buyer uses a fake escrow account such that the money returns to the buyer after receiving the goods

b. Counterfeit products or goods are products that are being manufactured and marketed, without formal authorization, under the name of a popular and recognized but are usually of lesser quality than the product they try to imitate

c. Measures that can be taken to stop fraudulent payments are;

1) Monitor transactions to to check for red flags, including disparity in shipping and billing information

Monitor transactions from customer that use free or anonymous emails services which can easily be opened and closed without payment or proper  documentation

2) Make use of Address Verification System to authenticate the billing address on a payment, and the address on the credit card.

7 0
3 years ago
How have productivity programs improved the professional lives of people? (check all that apply)
gtnhenbr [62]

Answer:

  • made it easier and less expensive to present information
  • made it easier and faster to communicate with others

Explanation:

productivity programs

productivity programs are designed and use for producing information easily and made it easier and faster to communicate with others

worksheets , charts , graphs , documents etc

MS office , Time management , projects management softwares are the example of  productivity programs

there are alot of tools which are designed to make conversation and communication more easy related to productivity program following are the example of tools

  • Microsoft Teams
  • slack
  • Zoom
  • Office 365
  • Poppulo
  • JIRA Cloud
  • Interact.
3 0
3 years ago
Read 2 more answers
Jeremy is the team leader of the employees planning to display the company’s new product at a big convention. He needs to be sur
Luden [163]
Assuming no options are provided, Jeremy would do well to create a weekly progress report, detailing what the company has accomplished during the week, and what remains to be accomplished. The report should be goal-based with defined deadlines, and clear explanations on what has been done and what remains to be done, and should be organized by the various aspects of the project (accounting, marketing, etc). This report will help keep his team conscience of their role within the larger project, what they have accomplished thus far, and what still needs to be done.
6 0
3 years ago
Read 2 more answers
Write a modular program that allows the user to enter a word or phrase and determines whether the word or phrase is a palindrome
Ostrovityanka [42]

Answer:

import java.util.Scanner;

public class num10 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a word");

       String word = in.nextLine();

       String reversed = "";

       //Get the length of the string entered

       int length = word.length();

       //Loop through the string and reverse th string

       for ( int i = length - 1; i >= 0; i-- )

           reversed = reversed + word.charAt(i);

       //Compare the two strings "word" and "reversed"

       if (word.equals(reversed))

           System.out.println(word+" is a palindrome");

       else

           System.out.println(word+" is not a palindrome");

   }

}

Explanation:

Since we know that a palindrome word is a word that reads the same forward and backward, The Idea here is:

  • To obtain a word from a user.  
  • Use a for loop to reverse the word and store in another variable
  • Use if....else to compare the two strings and determine if they are equal, if they are equal then the word is palindrome.
6 0
4 years ago
Other questions:
  • A password checking system that disallows user passwords that are proper names or words that are normally included in a dictiona
    15·1 answer
  • Which of the following refers to a combination of hardware and software that ensures only authorized individuals gain entry into
    11·1 answer
  • What does the cpu do (in terms of register contents and stack) when it executes a jsr instruction?
    12·1 answer
  • Two words are a ""reverse pair"" if each is the reverse of the other. Write a program that finds all the reverse pairs in the wo
    12·1 answer
  • Construct pseudocode for a program that prints ‘Hello World’ on the screen.
    7·2 answers
  • 1. Open the start file EX2019-ChallengeYourself-9-3. The file will be renamed automatically to include your name. Change the pro
    15·2 answers
  • What type of computer is used in ATM?
    11·2 answers
  • A system of classifying and organizing online content into categories by the use of user-generated metadata such as keywords is
    8·1 answer
  • What is meant by astigmation​
    9·2 answers
  • Which type of information should never be given out on social media?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!