In: Computer Science
In this project students will write a very simply program using Java’s input and output methods. The program will prompt the user to enter responses to several questions, displaying the answer each time. The project is designed to give students an opportunity to practice very basic input and output via a simple project.
Specification
When the Java program starts it should prompt the user for input and print a response (including that input) as follows:
Hello. What is your name? James_Brown
It's nice to meet you, James_Brown. How old are you? 42
I see that you are still quite young at only 42.
Where do you live? magicland
Wow! I've always wanted to go to magicland. Thanks for chatting
with me. Bye!
-note to use this: Scanner scnr = new Scanner(System.in);
import java.util.Scanner; public class InputOutputExamples { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); System.out.print("Hello. What is your name? "); String name = scnr.next(); System.out.print("It's nice to meet you, " + name + ". How old are you? "); String age = scnr.next(); System.out.println("I see that you are still quite young at only " + age + "."); System.out.print("Where do you live? "); String place = scnr.next(); System.out.println("Wow! I've always wanted to go to " + place + ". Thanks for chatting with me. Bye!"); } }