Guest User

Untitled

a guest
Jan 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. import java.io.*;
  2.  
  3.  
  4. public class CMDInfoStoring {
  5. // author Jake Bowden (Beta Version) Not Fully Developed!
  6. public static void main (String[] args) {
  7.  
  8.  
  9. System.out.println("Welcome to my Name/Password Testing Center! Please answer the following questions!");
  10. System.out.println(" Please answer the following questions!");
  11. System.out.print("Enter your name: ");
  12.  
  13.  
  14.  
  15.  
  16.  
  17. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  18.  
  19. String userName = null;
  20. String ConfirmInfo = null;
  21. String Password = null;
  22. boolean Question1 = false;
  23. boolean Question2 = false;
  24.  
  25.  
  26.  
  27. try {
  28. userName = br.readLine();
  29. } catch (IOException ioe) {
  30. System.out.println("Error trying to Read your name! IO Error!");
  31. System.exit(1);
  32. }
  33.  
  34. System.out.println("Thanks for the name, " + userName);
  35. Question1 = true;
  36. if(Question1 && !Question2);
  37. System.out.println("Question 1 Complete! 1/2 Questions Complete!");
  38. System.out.println();
  39.  
  40. System.out.println("What would you set as your password if it were required?");
  41.  
  42.  
  43.  
  44.  
  45.  
  46. try {
  47. Password = br.readLine();
  48. } catch (IOException ioe) {
  49. System.out.println("Error trying to Read your Password!");
  50. System.exit(1);
  51. }
  52.  
  53. Question2 = true;
  54. if(Question2 && Question1);
  55. System.out.println("Question 2 Complete! 2/2 questions Complete!");
  56. System.out.println("Your Information has been stored in a .txt file named Information!");
  57. System.out.println();
  58. try { BufferedWriter out = new BufferedWriter(new FileWriter("Information.txt"));
  59. out.write("" + userName);
  60. out.newLine();
  61. out.write("" + Password);
  62. out.close();
  63. }
  64. catch (IOException e)
  65. {
  66. System.out.println("Exception ");
  67. return ;
  68.  
  69. }
  70.  
  71. try {
  72. ConfirmInfo = br.readLine();
  73. } catch (IOException ioe) {
  74. System.out.println("Yes/no Answers Only!!");
  75. System.exit(1);
  76. }
  77. if(ConfirmInfo.equalsIgnoreCase("no")); {
  78. System.exit(1);
  79. System.out.println();
  80. }
  81. if(ConfirmInfo.equalsIgnoreCase("Yes")); {
  82. System.out.println("Ah thats great then! Let's Continue!");
  83. }
  84.  
  85.  
  86.  
  87. }
  88. }
Add Comment
Please, Sign In to add comment