class Point with instance variables as: xCoordinate(int) and yCoordinate(int). Write public instance methods (getters & setters) for each instance variable. Now, write a class Circle with private instance variables as radius and Pi (value is 3.14). Write public setter, getter for radius, Area method for calculating Area, Draw method for radius. Formula for calculating area=pi*r^2 Formula for calculating radius=Math.sqrt(xCordinate^2+yCordinate^2)   Extend a Circle class from Point class such as Class Circle extends Point Write a Default constructor in Circle class that sets radius, xCoordinate&yCoordinate to some default value e.g. -1; Write a Parameterized constructor in Circle class which takes xCoordinate, yCoordinate and radius as a parameter. E.g.                              Circle (int xCoordinate, int yCoordinate, double radius) {                              this.xCoordinate= xCoordinate;                              this.yCoordinate= yCoordinate;                              this.radius=radius;                              } Now write a ColoredCirlce class with private instance variable as color (String) and public setter & getters. Extend the ColoredCirclefrom Circle and do the following operations. Write a default constructor that sets radius, xCoordinate,yCoordinate& color to some default value e.g. -1 or “empty”; Write a parameterized constructor that takes radius, xCoordinate,yCoordinate& color as a parameter and initialize instance variables (same as point c).   Now write a Demo class which contains main method in order to demonstrate the behavior of all classes. Call parameterized constructor of Circle class as: Circle circle=new Circle(2,3,4.5); Print attributes and behavior of circle as: System.out.println(circle.getxCordinate()); System.out.println(circle.getyCordinate()); System.out.println(circle.getRadius()); System.out.println("Area="+circle.Area()); System.out.println("Drawing circle="+circle.Draw());       Call parameterized constructor of ColoredCircle class as: ColoredCirclecCircle=new ColoredCircle(2,3,4.5, “green”); Print attributes of cCircle as                        System.Out.println(cCircle.getXCoordinate());                            System.Out.println(cCircle.getYCoordinate());                         System.Out.println(cCircle.getRadius());                         System.Out.println(cCircle.getColor());          System.out.println("Drawing circle="+cCircle.Draw());

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
  1. class Point with instance variables as: xCoordinate(int) and yCoordinate(int). Write public instance methods (getters & setters) for each instance variable. Now, write a class Circle with private instance variables as radius and Pi (value is 3.14). Write public setter, getter for radius, Area method for calculating Area, Draw method for radius.
  • Formula for calculating area=pi*r^2
  • Formula for calculating radius=Math.sqrt(xCordinate^2+yCordinate^2)

 

  1. Extend a Circle class from Point class such as Class Circle extends Point
  2. Write a Default constructor in Circle class that sets radius, xCoordinate&yCoordinate to some default value e.g. -1;
  3. Write a Parameterized constructor in Circle class which takes xCoordinate, yCoordinate and radius as a parameter. E.g.

                             Circle (int xCoordinate, int yCoordinate, double radius) {

                             this.xCoordinate= xCoordinate;

                             this.yCoordinate= yCoordinate;

                             this.radius=radius;

                             }

Now write a ColoredCirlce class with private instance variable as color (String) and public setter & getters. Extend the ColoredCirclefrom Circle and do the following operations.

  1. Write a default constructor that sets radius, xCoordinate,yCoordinate& color to some default value e.g. -1 or “empty”;
  2. Write a parameterized constructor that takes radius, xCoordinate,yCoordinate& color as a parameter and initialize instance variables (same as point c).

 

Now write a Demo class which contains main method in order to demonstrate the behavior of all classes.

  1. Call parameterized constructor of Circle class as: Circle circle=new Circle(2,3,4.5);
  2. Print attributes and behavior of circle as:

System.out.println(circle.getxCordinate());

System.out.println(circle.getyCordinate());

System.out.println(circle.getRadius());

System.out.println("Area="+circle.Area());

System.out.println("Drawing circle="+circle.Draw());

 

 

 

  1. Call parameterized constructor of ColoredCircle class as: ColoredCirclecCircle=new ColoredCircle(2,3,4.5, “green”);
  2. Print attributes of cCircle as

                       System.Out.println(cCircle.getXCoordinate());                            System.Out.println(cCircle.getYCoordinate());

                        System.Out.println(cCircle.getRadius());

                        System.Out.println(cCircle.getColor());

         System.out.println("Drawing circle="+cCircle.Draw());

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps with 5 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