generated from ohjelmointi2/gradle-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
50 lines (45 loc) · 1.34 KB
/
Person.java
File metadata and controls
50 lines (45 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package part03;
/**
* The `Person` class represents an individual with a name and age. The class
* is incomplete and needs to be fixed. You will need to add private variables
* for storing the name and age, and fix the constructor and the getter methods.
*
* Do not change the signatures of the methods already provided.
*
* You can use the JUnit test provided to verify that your implementation works
* as expected. You can also write a main method to test your implementations.
*/
public class Person {
/**
* Constructs a new `Person` object with the specified name and age.
*
* @param name The name of the person.
* @param age The age of the person.
*/
public Person(String name, int age) {
// TODO: implement this constructor
}
/**
* Gets the age of the person.
*
* @return The age of the person as an integer.
*/
public int getAge() {
return 0; // TODO: implement this method
}
/**
* Gets the name of the person.
*
* @return The name of the person as a string.
*/
public String getName() {
return null; // TODO: implement this method
}
/**
* Returns a string representation of the person.
*/
@Override
public String toString() {
return "Person [name=" + getName() + ", age=" + getAge() + "]";
}
}