Created
May 12, 2013 19:12
-
-
Save Caleb2501/5564568 to your computer and use it in GitHub Desktop.
First Reddit coding challenge completed in Java! exciting! Got the basics through an Udemy course, liking it so far.
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
// create a program that will ask the users name, age, and reddit username. | |
// have it tell them the information back, in the format: | |
// your name is (blank), you are (blank) years old, | |
// and your username is (blank) | |
import java.util.Scanner; | |
public class Challenge1{ | |
public static void main(String[] args){ | |
String name, username; | |
int userAge; | |
Scanner input = new Scanner(System.in); | |
System.out.print("Enter your first and last name please: "); | |
name = input.nextLine(); | |
System.out.print("Enter your age: "); | |
userAge = input.nextInt(); | |
System.out.print("Enter your Reddit username: "); | |
username = input.next(); | |
System.out.println("Your name is " + name + ", you are " + | |
userAge + "yrs old, and your Reddit username is " + | |
username + "."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment