Advertisement
Go0dtry

Finished Product: Ballprogram.

Jul 11th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1.  
  2. package ball;
  3.  
  4. public class Ballprogram {
  5.  
  6. public static void main(String[] args)
  7. {
  8.  
  9.  
  10. Ball golfBall = new Ball();
  11.  
  12. golfBall.setColor("white");
  13. golfBall.setHardness("hard");
  14. golfBall.setSize("small");
  15.  
  16. Ball baseBall = new Ball();
  17.  
  18. baseBall.setColor("white");
  19. baseBall.setHardness("hard");
  20. baseBall.setSize("medium");
  21.  
  22. Ball soccerBall = new Ball();
  23.  
  24. soccerBall.setColor("green");
  25. soccerBall.setHardness("soft");
  26. soccerBall.setSize("large");
  27.  
  28. System.out.println( "GolfBall Properties: \n"+
  29. "Color = "+golfBall.getColor()+"\n"+
  30. "Hardness = "+golfBall.getHardness()+"\n"+
  31. "Size = "+golfBall.getSize());
  32.  
  33. golfBall.setColor("blue");
  34. golfBall.setHardness("soft");
  35. golfBall.setSize("large");
  36.  
  37. System.out.println("");
  38.  
  39. System.out.println( "GolfBall Properties Are Now: \n"+
  40. "Color = "+golfBall.getColor()+"\n"+
  41. "Hardness = "+golfBall.getHardness()+"\n"+
  42. "Size = "+golfBall.getSize());
  43.  
  44.  
  45. System.out.println("");
  46.  
  47. System.out.println( "BaseBall Properties: \n"+
  48. "Color = "+baseBall.getColor()+"\n"+
  49. "Hardness = "+baseBall.getHardness()+"\n"+
  50. "Size = "+baseBall.getSize());
  51.  
  52. baseBall.setColor("orange");
  53. baseBall.setHardness("hard");
  54. baseBall.setSize("medium");
  55.  
  56. System.out.println("");
  57.  
  58. System.out.println( "BaseBall Properties Are Now: \n"+
  59. "Color = "+baseBall.getColor()+"\n"+
  60. "Hardness = "+baseBall.getHardness()+"\n"+
  61. "Size = "+baseBall.getSize());
  62.  
  63.  
  64. System.out.println("");
  65.  
  66. System.out.println( "SoccerBall Properties: \n"+
  67. "Color = "+soccerBall.getColor()+"\n"+
  68. "Hardness = "+soccerBall.getHardness()+"\n"+
  69. "Size = "+soccerBall.getSize());
  70.  
  71. soccerBall.setColor("yellow");
  72. soccerBall.setHardness("soft");
  73. soccerBall.setSize("medium");
  74.  
  75. System.out.println("");
  76.  
  77. System.out.println( "SoccerBall Properties Are Now: \n"+
  78. "Color = "+soccerBall.getColor()+"\n"+
  79. "Hardness = "+soccerBall.getHardness()+"\n"+
  80. "Size = "+soccerBall.getSize());
  81.  
  82. }
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement