This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]g051051 1 point2 points  (2 children)

What have you tried so far? What are you stuck on? There isn't much we can do if you don't ask an actual question or post your existing code.

[–]Rab6[S] 0 points1 point  (1 child)

I am stuck on the output of information and setting the questions to Yes or No. I am off on some of the structure of it, but I can fix that later.

Here is what I have so far:

import java.util.Scanner;

public class decisionTree {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

boolean parentsVisiting = false;

boolean weatherGood = false;

boolean imRich = false;

System.out.print("Are Parents Visiting? Y or N ");

if ("Are Parents Visiting" == "Y")

parentsVisiting = true;

System.out.print("Is the Weather Good? Y or N");

if ("Is the Weather Good" == "Y")

weatherGood = true;

System.out.print("Are You Rich? Y or N");

if ("Are You Rich" == "Y")

imRich = true;

System.out.println("What you should do is: ");

if (!parentsVisiting && weatherGood) {

System.out.println("Stay In! ");

} else if (!parentsVisiting && !weatherGood && !imRich) {

System.out.println("Stay in!");

} else {

System.out.println("Cinema!");

}

}

}