Write a class called BlanketLadder that describes a blanket ladder by its height, width, number of rungs and colour. Write setters and getters for all instance data. Write a method that returns the space between rungs, assuming there is no rung at the bottom of the blanket ladder, a rung at the top, and that the rungs are equispaced. If the height of the blanket ladder is 21cm and there are 3 rungs, they should be 7cm apart. This method should return a double and you should print only 2 decimal spaces for each returned value (e.g., a 200cm blanket ladder with 3 rungs would have 66.67cm between rungs, not 66.666666666). When a blanket ladder is printed, it should be described as in the sample output below.
Write a class called Assignment3Lee123456 that creates two blanket ladders. Give them any dimensions, number of rungs and colours you'd like. Print both blanket ladders. Then print the distance between the rungs for both blanket ladders, referencing the colour of each blanket ladder using a getter (they should have different colours). Change one of the blanket ladder's colour to pink and the other's width to 68. Print both blanket ladders.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here