Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started