hello,
As you can see I am new to Java and would like some help with this problem. I've tried to solve it myself first but the issue that I'm having is I don't have the knowledge to know what I am doing wrong.
// create a program that will say "Name" and then allow the useer's input of "their name" // and then another response from the programme. import java.util.Scanner; public class HomeProject { public static void main(String[] args) { String yourName; String answer; String answer2 = "good, well have a nice day!"; String answer3 = "unlucky, well have a nice day anyway!"; Scanner input = new Scanner(System.in); System.out.println("What is your name?"); yourName = input.nextLine(); System.out.println(); System.out.println( "Hello " + yourName + ", are you feeling well?" ); answer = input.nextLine(); System.out.println(); if ("are you feeling well?".equals("yes")) { System.out.println(answer2); answer2 = input.nextLine(); System.out.println(); } else if ("are you feeling well?".equals("no")) { System.out.println(answer3); answer3 = input.nextLine(); System.out.println(); } input.close(); } }
Any help will be appreciated and I'm sure its just something simple that I haven't properly understood.
Thanks!