Activity BufferedReader.
Create a program where the computer will interact with the user.
Ask for the following.
(a) The full name of the user.
Computer’s reply: How are you (name of the user).
(b) The favorite food of the user.
Computer’s reply: We have the same favorite….
(c) The favorite movie of the user.
Computer’s reply: I don’t like that.
__________
Program Code:
import java.io.*;
class Activity{
public static void main(String [] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("What is your name: ");
String Name"How are you " + Name);
System.out.print("What is your favorite food: ");
String FavFood =br .readLine();
System.out.println("We have the same favorite, " + FavFood);
System.out.print("What is your favorite movie: ");
String FavMovie = br .readLine();
System.out.println("I don't like that, " + FavMovie);
}
}
Sample Output:
What is your name: User
How are you User
What is your favorite food: Rice
We have the same favorite, Rice
What is your favorite movie: Iron Man
I don’t like that, Iron Man