Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 "RED", "BASKETBALL";
System.out.println "AIR Pressure bgetPressure;
System.out.println "AIR Capacity bgetCapacity;
System.out.println "BALL Color bgetColor;
System.out.println "BALL Type bgetType;
System.out.printlnIs Ball full of AIR bisFull;
System.out.println "How much air is needed bneedsAir;
System.out.printlnIs Ball FLAT bisFlat;
System.out.println "Adding to pressure baddAir;
System.out.println "Adding to pressure baddAir;
System.out.printlnIs Ball full of AIR bisFull;
System.out.printlnIs Ball FLAT bisFlat;
Sample Output :
AIR Pressure
AIR Capacity
BALL Color RED
BALL Type BASKETBALL
Is Ball full of AIR false
How much air is needed
Is Ball FLAT true
Adding to pressure true
Adding to pressure false
Is Ball full of AIR true
Is Ball FLAT false
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started