Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public Person() {}
  2.  
  3. public int getAge() {
  4. return age;
  5. }
  6. public void setAge(int age) {
  7. this.age = age;
  8. }
  9.  
  10. public double getHeight() {
  11. return height;
  12. }
  13. public void setHeight(double height) {
  14. this.height = height;
  15. }
  16. public double getWeight() {
  17. return weight;
  18. }
  19. public void setWeight(double weight) {
  20. this.weight = weight;
  21. }
  22. public String getName() {
  23. return name;
  24. }
  25. public void setName(String name) {
  26. this.name = name;
  27. }
  28. public String getGender() {
  29. return gender;
  30. }
  31. public void setGender(String gender) {
  32. this.gender = gender;
  33. }
  34.  
  35. public static void buildFromFile(String location) throws FileNotFoundException{
  36.  
  37. File file = new File(location);
  38. Scanner input = new Scanner(file);
  39.  
  40. while(input.hasNextLine()) {
  41. String data = input.nextLine();
  42. for(int i = 0; i <= people.length; i++) {
  43. people[i].setName(data);
  44. }
  45. }
  46. for(int i = 0; i <= people.length; i++) {
  47. System.out.println(people[i]);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement