Question
Sample output: Starter code: import java.util.Scanner; public class Selection { static final String QUESTION1 = Does your tree have compound leaves?; static final String QUESTION2
Sample output:
Starter code:
import java.util.Scanner;
public class Selection { static final String QUESTION1 = "Does your tree have compound leaves?"; static final String QUESTION2 = "Does your tree have 7 or fewer leaflets?"; static final String QUESTION3 = "Are the leaflets rounded?"; static final String QUESTION4 = "Is the leaf 6-8 inches long?"; static final String QUESTION5 = "Are the leaves lobed?"; static final String QUESTION6 = "Is the bark papery?"; static final String QUESTION7 = "Are the leaf petioles flat?"; static final String QUESTION8 = "Are the leaves triangular?"; static final String QUESTION9 = "Is the leaf width equal to the length?"; static final String QUESTION10 = "Are the leaves finely toothed?"; static final String QUESTION11 = "Is the leaf at least 3 times longer than the width?"; static final String QUESTION12 = "Are the leaf veins thin?"; static final String QUESTION13 = "Is the bark dark?"; static final String QUESTION14 = "Are the leaves shiny"; static final String QUESTION15 = "Is the leaf base even?"; static final String ERROR = "There was an error!"; public static void main(String[] args) { Scanner scan = new Scanner(System.in); String yes = "y"; String no = "n";
System.out.println("Let's see what kind of tree you have!"); System.out.println("--------------------------------------");
/* add your code below */
In this assignment you will be implementing a Dichotomous Key. Dichotomous Keys are generally used as a simple system to identify different organisms. You will create a sequential structure that can be used by a user to identify different types of deciduous trees based on their features. The prompts you will be printing are included in the Starter Code. Each is a variable named with a question number. The table below features the logic your program should go through using those question numbers. It may be helpful to you to plan out your solution using a tree diagram. Tree Ta aa aa aa aa aa a al 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Shagbark Hickory Black Locust Mountain Ash Black Walnut Oak Birch Eastern Cottonwood Aspen Aspen Balsam Poplar Basswood Willow Black Cherry 3 3 - Hackberry 3 3 3 - Beech 3 3 3 - Ironwood 3 3 - Elm - Let's see what kind of tree you have! - - - - - - - - - - - - - - - Does your tree have compound leaves? [y] Does your tree have 7 or fewer leaflets? [n] Are the leaflets rounded? [y] Your tree: Black Locust! Let's see what kind of tree you have! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Does your tree have compound leaves? [n] Are the leaves lobed? [n] Is the bark papery? [n] Are the leaf petioles flat? [n] Is the leaf width equal to the length? [y] Are the leaves finely toothedStep 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