Advertisement
Guest User

Untitled

a guest
Sep 19th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. public class residence {
  2. String posision ;
  3. String username ;
  4. String pass ;
  5. String accNo ;
  6. String type ;
  7. String no ;
  8. public residence (String p ,String u ,String pas , String acc , String type , String no ){
  9. this.posision = p ;
  10. this.username = u ;
  11. this.pass = pas;
  12. this.accNo = acc;
  13. this.type = type ;
  14. this.no = no ;
  15.  
  16. }
  17. public residence (){}
  18. }
  19.  
  20. public class manager extends residence{
  21. public String posision ;
  22. public String username ;
  23. public String pass ;
  24. public String accNo ;
  25. public String type ;
  26. public String no ;
  27.  
  28. public manager (){
  29. super();
  30. }
  31. public manager(String p ,String u ,String pas , String acc , String type , String no){
  32. super(p , u , pas, acc, type , no);
  33. }
  34. public String getUsername (){ return username; }
  35. }
  36.  
  37. public static void main(String[] args) {
  38. File file = new File ("E:\guaz\eclipse_javafx\workspace\dkflozaTesting\src\dkflozaTesting\danial.txt");
  39. ArrayList<residence> building = new ArrayList<residence>();
  40. String posision ="";
  41. String username ="";
  42. String pass ="";
  43. String accNo = "" ;
  44. String type ="";
  45. String no = "";
  46. try{
  47. Scanner scan = new Scanner (file);
  48. while(scan.hasNext()){
  49. posision = scan.next();
  50. username= scan.next();
  51. pass = scan.next();
  52. accNo = scan.next();
  53. type= scan.next();
  54. no = scan.next();
  55. System.out.println(posision +" " + username +" "+ pass +" "+ type +" "+ no);
  56. if (posision.compareToIgnoreCase("m") == 0){
  57. System.out.println("in if : "+posision +" " + username +" "+ pass +" "+ type +" "+ no);
  58. manager mng = new manager(posision , username , pass , accNo , type , no );
  59. System.out.println("username : "+ mng.getUsername());
  60. building.add(mng);
  61. }
  62.  
  63. }
  64.  
  65. System.out.print("n n");
  66. //System.out.print(list.size());
  67. //System.out.print(list.get(0).getUsername());
  68. System.out.print("n n");
  69. }catch(Exception e){
  70. System.out.println(e.getLocalizedMessage());
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement