Created
May 7, 2013 10:10
-
-
Save edegula/5531610 to your computer and use it in GitHub Desktop.
/r/dailyprogrammer #001 - Easy
This file contains hidden or 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
package com.edegula.reddit.dailyprog.easy; | |
import java.util.Scanner; | |
public class Challenge001 { | |
private Scanner scanner; | |
private String name; | |
private int age; | |
private String userName; | |
/** | |
* Constructor | |
*/ | |
public Challenge001( ) { | |
scanner = new Scanner(System.in); | |
System.out.println("Enter your name: "); | |
name = scanner.nextLine(); | |
System.out.println("Enter your age: "); | |
age = Integer.valueOf(scanner.nextLine()); // scanner.nextInt barfing at the input | |
System.out.println("Enter your Username: "); | |
userName = scanner.nextLine(); | |
} | |
/** | |
* Display Entry | |
*/ | |
public void displayEntry() { | |
System.out.println("Your Name is " + this.name); | |
System.out.println("Your Age is " + this.age); | |
System.out.println("Your Username is " + this.userName); | |
} | |
public void writeEntry() { | |
// TODO write entry record to a file | |
} | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
Challenge001 c001 = new Challenge001(); | |
c001.displayEntry(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment