Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package lab8;
  2.  
  3. import java.text.SimpleDateFormat;
  4. import java.util.Calendar;
  5.  
  6. public class Persoana
  7. {
  8. private String name;
  9. private Calendar birthday;
  10. private String adress;
  11. private String phone;
  12.  
  13. public Persoana(String name, String day, String month, String year, String adress, String phone)
  14. {
  15. this.name = name;
  16. this.adress = adress;
  17. this.phone = phone;
  18. this.birthday = Calendar.getInstance();
  19. this.birthday.set(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
  20. }
  21.  
  22. public String getName()
  23. {
  24. return name;
  25. }
  26. public void setName(String name)
  27. {
  28. this.name = name;
  29. }
  30. public Calendar getBirthday()
  31. {
  32. return birthday;
  33. }
  34. public void setBirthday(Calendar birthday)
  35. {
  36. this.birthday = birthday;
  37. }
  38. public String getAdress()
  39. {
  40. return adress;
  41. }
  42. public void setAdress(String adress)
  43. {
  44. this.adress = adress;
  45. }
  46. public String getPhone()
  47. {
  48. return phone;
  49. }
  50. public void setPhone(String phone)
  51. {
  52. this.phone = phone;
  53. }
  54.  
  55. @Override
  56. public String toString()
  57. {
  58. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd");
  59.  
  60. return "<tr>"
  61. + "<td>" + this.getName() + "</td>"
  62. + "<td>" + sdf.format(this.getBirthday().getTime()) + "</td>"
  63. + "<td>" + this.getAdress() + "</td>"
  64. + "<td>" + this.getPhone() + "</td>"
  65. + "</tr>";
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement