Jump to content
Sign in to follow this  
Arrogance

Super simple Conversation Program.

Recommended Posts

[code]
import java.io.*;

class Conversation {

public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int myAge = 15;
System.out.println("What is your name?");
String name = in.readLine();
System.out.println("Your name is " + name + ", great name.");
System.out.println("How old are you?");
String age = in.readLine();
System.out.println("You are " +age+".");
System.out.print("If you added our ages together we would be" + (age + myAge) + " :)");
System.out.println("What is your favorite hobbie?");
String hobby = in.readLine();
System.out.println("What do you like about " + hobby+"?");
String otherHobby = in.readLine();
System.out.println("So what you're saying about " + otherHobby + " is neat.");
System.out.println("Well it was nice talking to you");
System.out.println("Please rate this program 1 - 10");
System.out.println("Type a number:");
String rating = in.readLine();
int value = Integer.parseInt(rating);
if (value > 5) {
System.out.println("You voted: "+value+".");
} else {
System.out.println("You voted: "+value+".");

}
System.out.println("End of program");
}
}
[/code]

Share this post


Link to post
Share on other sites
[quote name='Caelum']Good job.[/QUOTE]

Thanks man, I appreciate it.

Share this post


Link to post
Share on other sites
You know those books that leave words left out so you can fill them in yourself? This is practically that, it can easily be turned into something dirty.

Again good job, but you can do better.

Share this post


Link to post
Share on other sites
[quote name='Caelum']You know those books that leave words left out so you can fill them in yourself? This is practically that, it can easily be turned into something dirty.

Again good job, but you can do better.[/QUOTE]

Those are called ad-libs :P

Share this post


Link to post
Share on other sites
You may want to check out java.util.Scanner for easier input from console or files.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×