Question: CS136: Computer Science I -Spring 2019 uestions [15 points] Question #1 The java.awt.Rectangle class of the standard Java library does not supply methods for computing
![CS136: Computer Science I -Spring 2019 uestions [15 points] Question #1](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66eefc287ff45_15166eefc27e94dd.jpg)
CS136: Computer Science I -Spring 2019 uestions [15 points] Question #1 The java.awt.Rectangle class of the standard Java library does not supply methods for computing the area and the perimeter of a rectangle. Create a subclass BetterRectangle of the Rectangle class that has getPerimeter and getArea methods. Do not add any instance variables to the BetterRectangle class. In its constructor, call the setLocation and setSize methods of the Rectangle class. Create a tester class (BetterRectangleTester) with a main method that tests the methods of BetterRectangle BetterRectangleTester must have at least 3 test cases with input and expected output. Make sure that your code compiles and runs without errors when the following commands are used For compilation javac BetterRectangleTester.java BetterRectangle.java For execution: java BetterRectangleTester Grading Rubric Points Item Using inheritance to create BetterRectangle Implementing getPerimeter Implementing getArea Implementing three tests cases 4 4 6 [15 points] Question #2 A labeled point has x- and y-coordinates and a string label. Create a class LabeledPoint with a constructor LabeledPoint (int x, int y, String label) and a toString method that returns x, y, and the label. The class LabeledPoint must extend the Java AWT class (java.awt.Point). The toString method of LabeledPoint should invoke the toString method of the Point class. Also, the constructor of LabeledPoint should invoke a constructor from the Point class. Create a tester class (LabeledPointTester) with a main method that tests the toString method of LabeledPoint LabeledPointTester must have at least 3 test cases with input and expected output Make sure that your code compiles and runs without errors when the following commands are used: For compilation javac LabeledPointTester.java LabeledPoint.java For execution: java LabeledPointTester
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
