Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/box-class-and-colored-square-java/
- Program files for each of the following two programs
- 1. Box
- 2. ColoredSquare
- STEP 1: Box
- Create a class called Box.java that contains 3 double-precision instance variables named length, width and height. The class should include a constructor that initializes the three variables to 1. Also, you need a class method named volume() that returns the volume of a Box object. The volume of a box is given by its length times width times height .Write a class called BoxTest.java and declare an array of three Box objects to call the methods you declared in the Box class. Make sure that all class methods are called from main(). Have main() display the value returned by volume() and verify the returned value by hand calculations (paper/pencil). Prompt the user to enter the values for the length height and width each Box object in the array.
- STEP 2: Colored Square
- Eclipse’s debugging capabilities are impressive, even for a fully featured IDE. Practice all three basic debugging techniques (setting a break point, stepping through code, and variable watches) in your iLab this week.
- Lab 2 ColoredSquare
- Create an applet that produces a 400 by 400 square where the top half is blue and the bottom half is red. Hint look in the reading for GridLayout. Use 2 rows , i column.(20 points)
- Download: http://solutionzip.com/downloads/box-class-and-colored-square-java/
Advertisement
Add Comment
Please, Sign In to add comment