Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Description : Write a Ball class that will simulate a Ball used for playing a sport. The Ball will have a color, a type,

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());

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions