Question
public class Bouncer { public Bouncer(double d, int i) { // TODO Auto-generated constructor stub } public Bouncer(Bouncer c) { // TODO Auto-generated constructor stub
public class Bouncer {
public Bouncer(double d, int i) { // TODO Auto-generated constructor stub }
public Bouncer(Bouncer c) { // TODO Auto-generated constructor stub }
public double getBounciness() { // TODO Auto-generated method stub return 0; }
public Object getHeight() { // TODO Auto-generated method stub return null; }
public void setBounciness(int i) { // TODO Auto-generated method stub }
public void setBounciness(double d) { // TODO Auto-generated method stub }
public void setHeight(int i) { // TODO Auto-generated method stub }
public void bounce() { // TODO Auto-generated method stub }
public Object numberOfBounces() { // TODO Auto-generated method stub return null; }
}
public class Trampoline {
public Trampoline(int i, double d, int j) { // TODO Auto-generated constructor stub }
public Trampoline(Trampoline c) { // TODO Auto-generated constructor stub }
public Object getWeightOfJumper() { // TODO Auto-generated method stub return null; }
public Object getHeight() { // TODO Auto-generated method stub return null; }
public double getBounciness() { // TODO Auto-generated method stub return 0; }
public void setWeightOfJumper(int i) { // TODO Auto-generated method stub }
public void bounce() { // TODO Auto-generated method stub }
public Object numberOfBounces() { // TODO Auto-generated method stub return null; }
}
Skeleton of Bouncer and Trampoline Additional Requirements for Bouncer height should be greater than 0. If 0 or less is provided, set it to a default of 1. bounciness is a percentage value (between 0 and 1) and should not be 0% (meaning no bounce) nor 100% meaning no loss of height on a bounce. If an invalid percentage is provided, set the bounciness to a default of 50%. bounce() should update the height to reflect a single bounce. The object will be bounciness% of it's original height after a single bounce. (eg, if the height is 100 and bounciness is .9, then height is 90 after a single bounce.) The height should always be rounded down to the nearest integer numberOfBounces() returns the number of bounces before the object remains remains still on the ground (height is zero). The height should not change equals()returns true if the argument has the same height and bounciness. Note that the operatorwill return true if two objects refer to the same object. Bouncer -height: int -bounciness: double +Bouncer (bounciness:double, height: int) +Bouncer (tocopy:Bouncer) +setHeight (height:int) +getHeight ( ) : int +3etBouncines3 (bounciness:double) +getBounciness) double +bounce () 3(): int tequals (other: Bouncer) boolean Trampoline -we ightofJumper: int Trampoline (weightofJumpe height:double) +Trampoline (toCopy:Trampoline +setNeightofumper (veight:int) getNeightofJumper : int +get Bounciness ): double Additional Requirements for Trampoline weightoflumper is between 50 (inclusive) and 300 (inclusive) pounds. If weight is invalid, default to 140 getBounciness is overridden in this child class to adjust the bounciness based on the jumpers weight as follows: If the jumper's weight is less than 100, set it to 75% of the original bounciness, if greater than 150, set it to 110% of the original bounciness, if greater than 200 set it to 120% of the original bounciness. Leave the bounciness unchanged otherwise. (Note: you will need to call getBounciness in the parent to do this computation.) Notes: Do not duplicate instance variables from parent class in child class. Instead invoke appropriate super constructor and methods in parent classStep 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