Jess
January 17th, 2013, 07:21 PM
Yet another one. This one is due next Sunday, but I still need as much help as possible, before I go turn it in.
Write a tester program called RectangleTester that constructs two rectangles, calculates the perimeters of each rectangle, calculates the area of each rectangle, and then calculates the differences in the perimeters and the areas. (Use the getHeight and getWidth methods)
Print the differences using the System.out.println method
For your final submission RectangleTester should test two pairs of Rectangles. The rectangles of width, height 20,40 and 10, 35 and the rectangles 16, 30 and 18, 19.
Your output should be as follows: (it should match on spacing and capitalization and value)
Rectangle A Width 20.0 Height 40.0 Perimeter 120.0 Area 800.0
Rectangle B Width 10.0 Height 35.0 Perimeter 90.0 Area 350.0
Differences between A and B: Perimeter 30.0Area 450.0
Rectangle A Width 16.0 Height 30.0 Perimeter 92.0 Area 480.0
Rectangle B Width 18.0 Height 19.0 Perimeter 74.0 Area 342.0
Differences between A and B: Perimeter 18.0Area 138.0
Note: not asking you to do the homework for me....I still have trouble understanding Java and want to be guided in the right direction. Right now I haven't started on it, so no need to post tips or whatever.
Write a tester program called RectangleTester that constructs two rectangles, calculates the perimeters of each rectangle, calculates the area of each rectangle, and then calculates the differences in the perimeters and the areas. (Use the getHeight and getWidth methods)
Print the differences using the System.out.println method
For your final submission RectangleTester should test two pairs of Rectangles. The rectangles of width, height 20,40 and 10, 35 and the rectangles 16, 30 and 18, 19.
Your output should be as follows: (it should match on spacing and capitalization and value)
Rectangle A Width 20.0 Height 40.0 Perimeter 120.0 Area 800.0
Rectangle B Width 10.0 Height 35.0 Perimeter 90.0 Area 350.0
Differences between A and B: Perimeter 30.0Area 450.0
Rectangle A Width 16.0 Height 30.0 Perimeter 92.0 Area 480.0
Rectangle B Width 18.0 Height 19.0 Perimeter 74.0 Area 342.0
Differences between A and B: Perimeter 18.0Area 138.0
Note: not asking you to do the homework for me....I still have trouble understanding Java and want to be guided in the right direction. Right now I haven't started on it, so no need to post tips or whatever.