Helpin OOP

Helpin OOP

Please I need help solving this Oval and FilledOval code by changing the instance variables in Oval that are in public, which is not optimal, to private and re-implement any code that depended on the public accessibility of those instance variables. Here is the code:

import java.awt.*;

public class Oval { public int x, y, w, h;

public Oval(int x, int y, int w, int h) {
    this.x = x; this.y = y; this.w = w; this.h = h;
}

public void draw(Graphics g) {
    g.drawOval(x,y,w,h;
}

public int getWidth() { return w; }

public int getHeight() { return h; }

public Point getTopLeftPoint() { return new Point(x,y); }
//...other methods...

}

public class FilledOval extends Oval { public FilledOval(int x, int y, int w, int h) { super(x, y, w, h); }

public void draw(Graphics g)
{
    g.fillOval(x, y, w, h);
}

}

View Answers

Ads









Related Tutorials/Questions & Answers:
Helpin OOP
Helpin OOP  Please I need help solving this Oval and FilledOval code by changing the instance variables in Oval that are in public, which is not optimal, to private and re-implement any code that depended on the public
oop concept
oop concept  why Object class is super class for all class? 1.to use the Object class methods in subclass directly or 2.the Object class is usefull at the time of object create of subclass what
Advertisements
oop
OOP
Java with OOP assignment (Eclipse)
Java with OOP assignment (Eclipse)  How do i control the length of characters in an input? E.g.: Enter your name > Hi * Name too short
ModuleNotFoundError: No module named 'oop-ext'
ModuleNotFoundError: No module named 'oop-ext'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'oop-ext' How to remove the ModuleNotFoundError: No module named 'oop-ext
what is the difference between pop and oop
what is the difference between pop and oop  what is the difference between pop and oop
ModuleNotFoundError: No module named 'bottle-oop-rest'
ModuleNotFoundError: No module named 'bottle-oop-rest'  Hi, My... named 'bottle-oop-rest' How to remove the ModuleNotFoundError: No module named 'bottle-oop-rest' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'distributions-practice-OOP'
ModuleNotFoundError: No module named 'distributions-practice-OOP'  Hi...: No module named 'distributions-practice-OOP' How to remove the ModuleNotFoundError: No module named 'distributions-practice-OOP' error? Thanks
ModuleNotFoundError: No module named 'distributions-practice-OOP'
ModuleNotFoundError: No module named 'distributions-practice-OOP'  Hi...: No module named 'distributions-practice-OOP' How to remove the ModuleNotFoundError: No module named 'distributions-practice-OOP' error? Thanks
ModuleNotFoundError: No module named 'distributions-practice-OOP'
ModuleNotFoundError: No module named 'distributions-practice-OOP'  Hi...: No module named 'distributions-practice-OOP' How to remove the ModuleNotFoundError: No module named 'distributions-practice-OOP' error? Thanks
ModuleNotFoundError: No module named 'DS-OOP-Review'
ModuleNotFoundError: No module named 'DS-OOP-Review'  Hi, My... 'DS-OOP-Review' How to remove the ModuleNotFoundError: No module named 'DS-OOP-Review' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'distributions-practice-OOP'
ModuleNotFoundError: No module named 'distributions-practice-OOP'  Hi...: No module named 'distributions-practice-OOP' How to remove the ModuleNotFoundError: No module named 'distributions-practice-OOP' error? Thanks
ModuleNotFoundError: No module named 'DS-OOP-Review'
ModuleNotFoundError: No module named 'DS-OOP-Review'  Hi, My... 'DS-OOP-Review' How to remove the ModuleNotFoundError: No module named 'DS-OOP-Review' error? Thanks   Hi, In your python
registration form using oop concept
registration form using oop concept  I would like to write a program student registration form at kindergartens and display the information of students that register to the kindergarten. How to make the form and display
java oop
Java with OOP assignment (Eclipse) - Java Beginners
Java with OOP assignment (Eclipse)  "THREE Ts GAME" *Description* A "tic-tac-toe" game is a two player's board game where the game board is made of 3 X 3 grids. The two players, one being assigned with 'O' and the other
OOP
OOP       OOPs stands for Object oriented  Programming. Previously we used to follow.../beginners/oop-in-java.shtml
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.16.0 is released. Learn to use oop-lib-jvm version 0.16.0 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.16.0 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.16.0.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.16.1 is released. Learn to use oop-lib-jvm version 0.16.1 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.16.1 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.16.1.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.17.0 is released. Learn to use oop-lib-jvm version 0.17.0 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.17.0 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.17.0.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.17.1 is released. Learn to use oop-lib-jvm version 0.17.1 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.17.1 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.17.1.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.17.2 is released. Learn to use oop-lib-jvm version 0.17.2 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.17.2 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.17.2.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.17.3 is released. Learn to use oop-lib-jvm version 0.17.3 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.17.3 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.17.3.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.17.4 is released. Learn to use oop-lib-jvm version 0.17.4 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.17.4 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.17.4.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.18.0 is released. Learn to use oop-lib-jvm version 0.18.0 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.18.0 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.18.0.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.18.1 is released. Learn to use oop-lib-jvm version 0.18.1 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.18.1 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.18.1.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.18.2 is released. Learn to use oop-lib-jvm version 0.18.2 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.18.2 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.18.2.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.19.0 is released. Learn to use oop-lib-jvm version 0.19.0 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.19.0 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.19.0.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.20.0 is released. Learn to use oop-lib-jvm version 0.20.0 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.20.0 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.20.0.
Maven dependency for it.unibo.tuprolog - oop-lib-jvm version 0.20.1 is released. Learn to use oop-lib-jvm version 0.20.1 in Maven based Java projects
Maven dependency for  it.unibo.tuprolog  - Version 0.20.1 of oop-lib-jvm released The developers of   it.unibo.tuprolog - oop-lib-jvm..., the released version of  it.unibo.tuprolog - oop-lib-jvm library is 0.20.1.

Ads