Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class CMDInfoStoring {
- // author Jake Bowden (Beta Version) Not Fully Developed!
- public static void main (String[] args) {
- System.out.println("Welcome to my Name/Password Testing Center! Please answer the following questions!");
- System.out.println(" Please answer the following questions!");
- System.out.print("Enter your name: ");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String userName = null;
- String ConfirmInfo = null;
- String Password = null;
- boolean Question1 = false;
- boolean Question2 = false;
- try {
- userName = br.readLine();
- } catch (IOException ioe) {
- System.out.println("Error trying to Read your name! IO Error!");
- System.exit(1);
- }
- System.out.println("Thanks for the name, " + userName);
- Question1 = true;
- if(Question1 && !Question2);
- System.out.println("Question 1 Complete! 1/2 Questions Complete!");
- System.out.println();
- System.out.println("What would you set as your password if it were required?");
- try {
- Password = br.readLine();
- } catch (IOException ioe) {
- System.out.println("Error trying to Read your Password!");
- System.exit(1);
- }
- Question2 = true;
- if(Question2 && Question1);
- System.out.println("Question 2 Complete! 2/2 questions Complete!");
- System.out.println("Your Information has been stored in a .txt file named Information!");
- System.out.println();
- try { BufferedWriter out = new BufferedWriter(new FileWriter("Information.txt"));
- out.write("" + userName);
- out.newLine();
- out.write("" + Password);
- out.close();
- }
- catch (IOException e)
- {
- System.out.println("Exception ");
- return ;
- }
- try {
- ConfirmInfo = br.readLine();
- } catch (IOException ioe) {
- System.out.println("Yes/no Answers Only!!");
- System.exit(1);
- }
- if(ConfirmInfo.equalsIgnoreCase("no")); {
- System.exit(1);
- System.out.println();
- }
- if(ConfirmInfo.equalsIgnoreCase("Yes")); {
- System.out.println("Ah thats great then! Let's Continue!");
- }
- }
- }
Add Comment
Please, Sign In to add comment