2. More Shapes by CodeChum Admin Since we are interested with drawing in this quiz (it seems), consider a Shape object. We know that for regular shapes (like Rectangle and Circle), they have properties like area and perimeter. Let's also assume that these Shapes have color (simply a String for the purpose of this quiz) and whether the shapes are filled with this color or not (boolean). Construct a class called Shape that has color and filled as attributes. It should also have methods: area() and perimeter(). But Shape does not know how to compute for this. These methods should be defined properly in Shape and Shape must be defined accordingly as well. Define Rectangle and Circle classes. Rectangle has a length and a width, while Circle a radius. For purposes of this quiz, all these attributes are positive integers. Both Rectangle and Circle are Shapes. So you should know what to do. Implement a toString() method as well printing the information about the Shape object. Also, when defining area() and perimeter() in Shape, take note that the area and perimeter for some shapes are not always integers. Note: Use Math.PI for pi Input The first input is either 1 (a Rectangle) or 2 (a Circle). If it is a Rectangle, 2 positive integers follow (length and width). If it is a Circle, there is only integer that follows (radius). The next input is either true (filled) or false (not filled) and it follows a string which is the color. 1·4·8 Orange true Output Simply print the result returned by invoking toString(). And print the area and perimeter of the shapes. If the area and/or the perimeter is not a whole number, print the value with two decimal places. If the shape is filled, print the color, else, end of output. Rectangle:·length:·4,·width:·8 Area:·32 Perimeter:·24 Color:·Orange

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Java code please 2. More Shapes by CodeChum Admin Since we are interested with drawing in this quiz (it seems), consider a Shape object. We know that for regular shapes (like Rectangle and Circle), they have properties like area and perimeter. Let's also assume that these Shapes have color (simply a String for the purpose of this quiz) and whether the shapes are filled with this color or not (boolean). Construct a class called Shape that has color and filled as attributes. It should also have methods: area() and perimeter(). But Shape does not know how to compute for this. These methods should be defined properly in Shape and Shape must be defined accordingly as well. Define Rectangle and Circle classes. Rectangle has a length and a width, while Circle a radius. For purposes of this quiz, all these attributes are positive integers. Both Rectangle and Circle are Shapes. So you should know what to do. Implement a toString() method as well printing the information about the Shape object. Also, when defining area() and perimeter() in Shape, take note that the area and perimeter for some shapes are not always integers. Note: Use Math.PI for pi Input The first input is either 1 (a Rectangle) or 2 (a Circle). If it is a Rectangle, 2 positive integers follow (length and width). If it is a Circle, there is only integer that follows (radius). The next input is either true (filled) or false (not filled) and it follows a string which is the color. 1·4·8 Orange true Output Simply print the result returned by invoking toString(). And print the area and perimeter of the shapes. If the area and/or the perimeter is not a whole number, print the value with two decimal places. If the shape is filled, print the color, else, end of output. Rectangle:·length:·4,·width:·8 Area:·32 Perimeter:·24 Color:·Orange
E Run Tests
Test Case 1
Input
14 8
orange
true
Your
Rectangle: 1length: 4, width:
Output
Area: 32.00
Perimeter: 24.00
Color: Orange
Expected
Output
Rectangle: 1length: 4, width:
Area: 32
Perimeter: 24
Color: Orange
REDMI NOTE 10
Transcribed Image Text:E Run Tests Test Case 1 Input 14 8 orange true Your Rectangle: 1length: 4, width: Output Area: 32.00 Perimeter: 24.00 Color: Orange Expected Output Rectangle: 1length: 4, width: Area: 32 Perimeter: 24 Color: Orange REDMI NOTE 10
Test Case 2 Hidden
Test Case 3
in.
Input
29
Pink
false
Your
Circle: radius: 9
Output
Area: 254.47
Perimeter: 56.55
Expected
Output
Circle: radius: 9
Area: 254.47
Perimeter: 56.55
Test Case 4
Hidden
REDMI NOTE 10Test Case 5
Transcribed Image Text:Test Case 2 Hidden Test Case 3 in. Input 29 Pink false Your Circle: radius: 9 Output Area: 254.47 Perimeter: 56.55 Expected Output Circle: radius: 9 Area: 254.47 Perimeter: 56.55 Test Case 4 Hidden REDMI NOTE 10Test Case 5
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY