Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 7.2: Fruit Codes (10 pts) 70% of the produce sold in the U.S. contains pesticide residues [1]. One large study published in the respected

Assignment 7.2: Fruit Codes (10 pts)

70% of the produce sold in the U.S. contains pesticide residues [1].

One large study published in the respected medical journal JAMA, found that people who consumed the most organic foods had 25% fewer cancers than those who ate no organic food [2].

Additionally, foods that are genetically modified tend to be sprayed with large amounts of weed killers [3].

Regardless of these concerns, most nutrition experts agree that eating fruits and vegetables - either conventional or organic - in large quantities is one of the most important things you can do for your health [4]

Write a program to read in the code printed the sticker on a piece of fruit and print out whether the fruit was grown organically, or conventionally or was genetically modified.

The program should prompt the user to enter the numeric code on the fruit's sticker.

Codes that are 4 digits long indicate that the fruit has been grown conventionally.

In this case, print the message: "Your fruit was grown conventionally, with the use of pesticides and chemicals."

Codes that are 5 digits long, and start with an 8, indicate that the fruit has been genetically modified.

In this case, print the message: "Your fruit was genetically modified."

Codes that are 5 digits long, and start with a 9, indicate that the fruit was grown organically.

In this case, print the message: "Your fruit was not genetically modified, and was grown according USDA organic standards."

Name your file Fruit.java.

The program should work identically to the sample output below.

Additionally, your code should use exactly two sets of if-else statements for full credit (note that the use of else if is not allowed on this assignment).

Sample Output:

Enter the fruit code: 96544

Your fruit was not genetically modified, and was grown according USDA organic standards.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

Students also viewed these Databases questions

Question

6. Explain the power of labels.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago