Monty374

Weight

Nov 25th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. package puck;
  2.  
  3. public class Weight extends Circle {
  4. private double weight;
  5.  
  6. public Weight(double w){
  7. weight = w;
  8. }
  9.  
  10. public void setWeight(double newWeight){
  11. weight = newWeight;
  12. }
  13.  
  14. public double getWeight(){
  15. return(weight);
  16. }
  17.  
  18. public String toString() {
  19. String weightString;
  20.  
  21. weightString = "The weight is " + weight + ".";
  22. return(weightString);
  23. }
  24. }
Add Comment
Please, Sign In to add comment