Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ball;
- public class Ballprogram {
- public static void main(String[] args)
- {
- Ball golfBall = new Ball();
- golfBall.setColor("white");
- golfBall.setHardness("hard");
- golfBall.setSize("small");
- Ball baseBall = new Ball();
- baseBall.setColor("white");
- baseBall.setHardness("hard");
- baseBall.setSize("medium");
- Ball soccerBall = new Ball();
- soccerBall.setColor("green");
- soccerBall.setHardness("soft");
- soccerBall.setSize("large");
- System.out.println( "GolfBall Properties: \n"+
- "Color = "+golfBall.getColor()+"\n"+
- "Hardness = "+golfBall.getHardness()+"\n"+
- "Size = "+golfBall.getSize());
- System.out.println("");
- System.out.println( "BaseBall Properties: \n"+
- "Color = "+baseBall.getColor()+"\n"+
- "Hardness = "+baseBall.getHardness()+"\n"+
- "Size = "+baseBall.getSize());
- System.out.println("");
- System.out.println( "SoccerBall Properties: \n"+
- "Color = "+soccerBall.getColor()+"\n"+
- "Hardness = "+soccerBall.getHardness()+"\n"+
- "Size = "+soccerBall.getSize());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement