Question: This lab was designed to teach you more designing and writing classes. Use the same runner code below and associated comments to create a Ball

This lab was designed to teach you more designing and writing classes. Use the same runner code below and associated comments to create a Ball class.
Lab Description : Write a Ball class that will simulate a Ball used for playing a sport.
The Ball will have a color, a type, air pressure, and air pressure capacity.
A Ball is flat is it contains less than half of the capacity of air.
Air can be added up to the capacity.
Sample Runner Code :
Ball b = new Ball(30,11, "RED", "BASKETBALL");
System.out.println( "AIR Pressure "+ b.getPressure());
System.out.println( "AIR Capacity "+ b.getCapacity());
System.out.println( "BALL Color "+ b.getColor());
System.out.println( "BALL Type "+ b.getType());
System.out.println("Is Ball full of AIR "+ b.isFull());
System.out.println( "How much air is needed "+ b.needsAir());
System.out.println("Is Ball FLAT "+ b.isFlat());
System.out.println( "Adding 20 to pressure "+ b.addAir(20));
System.out.println( "Adding 20 to pressure "+ b.addAir(20));
System.out.println("Is Ball full of AIR "+ b.isFull());
System.out.println("Is Ball FLAT "+ b.isFlat());
Sample Output :
AIR Pressure 11.0
AIR Capacity 30.0
BALL Color RED
BALL Type BASKETBALL
Is Ball full of AIR false
How much air is needed 19.0
Is Ball FLAT true
Adding 20 to pressure true
Adding 20 to pressure false
Is Ball full of AIR true
Is Ball FLAT false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!