Define an interface named shape with a single method named area that calculates the area of the geometric shape: public double area (); Next, define a class named cirele that implements Shape. The cirele class should have an instance variable for the radius, a constructor that sets the radius, accessor/ mutator methods for the radius, and an implementation of the area method. Also define a class named Rectangle that implements shape. The Rectangle class should have instance variables for the height and width, a constructor that sets the height and width, accessor and mutator methods for the height and width, and an implementation of the area method. Programming Projects 757 The following test code should then output the area of the cirele and Rectangle objects: public static void main (String() args) circle e- new circle (4), // Radius of 4 Rectangle r - new Rectangle (4,3); // Neight - 4, Width - 3 Showarea (e), Showarea (r) I public static void Showarea (Shape a) double area- .area() System.out.printin("The area of the shape is "+ area);
Define an interface named shape with a single method named area that calculates the area of the geometric shape: public double area (); Next, define a class named cirele that implements Shape. The cirele class should have an instance variable for the radius, a constructor that sets the radius, accessor/ mutator methods for the radius, and an implementation of the area method. Also define a class named Rectangle that implements shape. The Rectangle class should have instance variables for the height and width, a constructor that sets the height and width, accessor and mutator methods for the height and width, and an implementation of the area method. Programming Projects 757 The following test code should then output the area of the cirele and Rectangle objects: public static void main (String() args) circle e- new circle (4), // Radius of 4 Rectangle r - new Rectangle (4,3); // Neight - 4, Width - 3 Showarea (e), Showarea (r) I public static void Showarea (Shape a) double area- .area() System.out.printin("The area of the shape is "+ area);
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...
Related questions
Question
provide code in java & dry run solution
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY