-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b33009
commit 4f41af3
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import java.util.Scanner; | ||
public class ChatBot { | ||
public static void main(String[] args){ | ||
Scanner scan = new Scanner(System.in); | ||
System.out.println("Hello. What is your name?"); | ||
//Pick up user's name and store it. | ||
String userName = scan.nextLine(); | ||
|
||
//add new a line before asking next question. | ||
System.out.println("Hi "+userName+" ! I'm Javabot. Where are you from?"); | ||
//Pick up user's home and store it. | ||
String address = scan.nextLine(); | ||
|
||
|
||
//add new a line before asking next question. | ||
System.out.println("I hear it's beautiful at "+address+" ! I'm from a place called Oracle"); | ||
System.out.println("How old are you?"); | ||
//Pick up age and store it. | ||
int age = scan.nextInt(); | ||
|
||
//add new a line before asking next question. | ||
System.out.println("So you're " +age+" , cool! I'm 400 years old."); | ||
System.out.println("This means I'm "+400/age+" times older than you."); | ||
System.out.println("Enough about me. What's your favourite language? (just don't say Python)"); | ||
//Pick up language and store it. | ||
scan.nextLine(); | ||
String language = scan.nextLine(); | ||
|
||
//add new a line here. | ||
System.out.println(language+", that's great! Nice chatting with you "+userName+". I have to log off now. See ya!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters