Question
Suppose that you have the following class definitions: [O2] [4 Marks] public class Shape { private int point; private String color; public Shape(int a, String
Suppose that you have the following class definitions: [O2] [4 Marks]
public class Shape { private int point; private String color; public Shape(int a, String g) { point = a; color = g; } public void display() { System.out.println(point); System.out.println(color); } } | public class Circle extends Shape { private double radius; public Circle(int i, String j, double r) { //Postcondition: point=i,color=j,radius=r } public void show() { //Output the values of point,color and radius } } |
a. Write the definition of the constructor Circle [2 marks]
b. Write the definition of the method show [2 marks]
java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started