Menu

[Solved] Note Need Write Documentation Program Documentation Aded Need Write Java Program Implement Q37170123

NOTE: You need to write documentation of your program. Documentation will be aded You need to write java program which implem. Override the tostring() method to return A Square with side-xx, which is a subclass of yyy, where yyy is the output of theNOTE: You need to write documentation of your program. Documentation will be aded You need to write java program which implement the following class diagram. Write a superclass called Shape (as shown in the class diagram), which contains .Two instance variables color (String) and filled (boolean). .Two constructors: a noarg (no-argument) constructor that initializes the color to “green” and filled to true, and a constructor that initializes the color and f111ed to the given values. Getter and setter for all the instance variables. By convention, the getter for a boolean variable xxx is called isXXX() (instead of getxxx() for all the other types). A toString() method that returns “A Shape with color of xxx and fi11ed/Not filled Wite two subcdasses of Shape alled Circle and Rectangle as shown in the cis dhagram The Circle class contains: An instance variable radius (double). Three constructors as shown. The no-arg constructor initializes the radius to 1.e Getter and setter for the instance variable radius. Methods getArea() and getPerimeter() Override the tostring() method inherited, to return “A Circle with radius ox, which is a subclass of yyy, where yyy is the output of the tostring() method from the superclass. The Rectangle class contains: . Two instance variables width (double) and length (double). Three constructors as shown. The no-arg constructor initializes the width and length to 1.e. Getter and setter for all the instance variables. Methods getArea() and getPerimeter). Override the tostring() method inherited, to return “A Rectangle with widthax and length#2, which is a subclass of yyy”, where yyy is the the tostring() method from the superclass. z, which i modeled as a subclass of Rectangle. Square has no instance variable, but inherits the instance variables width and length from its superclass Rectangle. Write a class called Square, as a subclass of Rectangle. Convince yourself that Square can be Provide the appropriate constructors (as shown in the class diagram). Page | 2 . Override the tostring() method to return “A Square with side-xx, which is a subclass of yyy, where yyy is the output of the tostring() method from the superclass .Do you need to override the getarea() and getPerimeter()? Try them out . Override the setlength() and setwidth() to change both the width and length, so as to maintain the square geometry. Step 4 (TestShape Class):Write a test program to test all the methods defined in Shape, Circle, Rectangle and Square. Shape -color:string :-red. filled:boolean true +Shape() Shape(color:String, filled:boolean) .getcolor():Strige setColor(color:String):void .isilled):boolean setFilled(filled:boolean):void +toString):String Circle Rectangie idth:double 1.0 length double # 1.0 radius:double 1.e circle() Circle(radius : double) Circle(radius: double Rectangle) ·Rectangle(width:double, length:double) Rectangle(widt h double, color:String,filled:boolean) getRadius):double setRadius(radius:double) :void getArea():double .getPerineter():double toString):String length:double color: String,filled:boolean) -getwidth ):double setidth (th:ouble)zvold cettength):double setlength(legnth:double) :vold .getAreaC) :double egetPerinmeter):double etoString):Strie Square Squere () Square(side:double) Square(side double, color:String,filled:boolean) getside):double esetside( side: double) :void (side: double) setlength(side :double)zvolad +tostring)String Page | 3 Show transcribed image text NOTE: You need to write documentation of your program. Documentation will be aded You need to write java program which implement the following class diagram. Write a superclass called Shape (as shown in the class diagram), which contains .Two instance variables color (String) and filled (boolean). .Two constructors: a noarg (no-argument) constructor that initializes the color to “green” and filled to true, and a constructor that initializes the color and f111ed to the given values. Getter and setter for all the instance variables. By convention, the getter for a boolean variable xxx is called isXXX() (instead of getxxx() for all the other types). A toString() method that returns “A Shape with color of xxx and fi11ed/Not filled Wite two subcdasses of Shape alled Circle and Rectangle as shown in the cis dhagram The Circle class contains: An instance variable radius (double). Three constructors as shown. The no-arg constructor initializes the radius to 1.e Getter and setter for the instance variable radius. Methods getArea() and getPerimeter() Override the tostring() method inherited, to return “A Circle with radius ox, which is a subclass of yyy, where yyy is the output of the tostring() method from the superclass. The Rectangle class contains: . Two instance variables width (double) and length (double). Three constructors as shown. The no-arg constructor initializes the width and length to 1.e. Getter and setter for all the instance variables. Methods getArea() and getPerimeter). Override the tostring() method inherited, to return “A Rectangle with widthax and length#2, which is a subclass of yyy”, where yyy is the the tostring() method from the superclass. z, which i modeled as a subclass of Rectangle. Square has no instance variable, but inherits the instance variables width and length from its superclass Rectangle. Write a class called Square, as a subclass of Rectangle. Convince yourself that Square can be Provide the appropriate constructors (as shown in the class diagram). Page | 2
. Override the tostring() method to return “A Square with side-xx, which is a subclass of yyy, where yyy is the output of the tostring() method from the superclass .Do you need to override the getarea() and getPerimeter()? Try them out . Override the setlength() and setwidth() to change both the width and length, so as to maintain the square geometry. Step 4 (TestShape Class):Write a test program to test all the methods defined in Shape, Circle, Rectangle and Square. Shape -color:string :-red. filled:boolean true +Shape() Shape(color:String, filled:boolean) .getcolor():Strige setColor(color:String):void .isilled):boolean setFilled(filled:boolean):void +toString):String Circle Rectangie idth:double 1.0 length double # 1.0 radius:double 1.e circle() Circle(radius : double) Circle(radius: double Rectangle) ·Rectangle(width:double, length:double) Rectangle(widt h double, color:String,filled:boolean) getRadius):double setRadius(radius:double) :void getArea():double .getPerineter():double toString):String length:double color: String,filled:boolean) -getwidth ):double setidth (th:ouble)zvold cettength):double setlength(legnth:double) :vold .getAreaC) :double egetPerinmeter):double etoString):Strie Square Squere () Square(side:double) Square(side double, color:String,filled:boolean) getside):double esetside( side: double) :void (side: double) setlength(side :double)zvolad +tostring)String Page | 3

Expert Answer


Answer to NOTE: You need to write documentation of your program. Documentation will be aded You need to write java program which i… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *