Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package christmas;
- public class Present {
- private String name;
- private String gender;
- private Double weight;
- public Present(String name, Double weight, String gender) {
- this.name = name;
- this.gender = gender;
- this.weight = weight;
- }
- public String getName() {
- return name;
- }
- public String getGender() {
- return gender;
- }
- public Double getWeight() {
- return weight;
- }
- @Override
- public String toString() {
- return "Present " + this.getName() + " (" + String.format("%.2f",this.getWeight()) + ") for a " +this.getGender().trim();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement