1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nirvana33 [79]
3 years ago
8

Given the class 'ReadOnly' with the following behavior: A (protected) integer instance variable named 'val'. A constructor that

accepts an integer and assigns the value of the parameter to the instance variable 'val'. A method name 'getVal' that returns the value of 'val'. Write a subclass named 'ReadWrite' with the following additional behavior: Any necessary constructors. a method named 'setVal' that accepts an integer parameter and assigns it the the 'val' instance variable. a method 'isDirty' that returns true if the setVal method was used to override the value of the 'val' variable.
Computers and Technology
1 answer:
Dafna1 [17]3 years ago
7 0

Answer:

I believe you want a subclass so here it is!

public class ReadWrite extends ReadOnly {

public ReadWrite(int initialValue){

super(initialValue);

}

private boolean modified = false;

public void setVal(int x) {

val = x;

modified = true;

}

public boolean isDirty() {

return modified;

}

}

Explanation:

I might be wrong, just check through it in case

Hope this helped

:)

You might be interested in
Please help me, I honestly dont know what happened to my laptop.
Alex787 [66]
Restart the whole computer??
7 0
3 years ago
Read 2 more answers
Samantha is in the beginning stages of OOP program development. What are the five steps she must follow for creating an OOP prog
lora16 [44]

Answer:

1. Classes and objects

2. Inheritance

3. Polymorphism

4. Data hiding/ encapsulation

5. Interfaces.

Explanation:

Classes and objects depict the major component of the OOP (object oriented programming). It explains the object like a ball in a soccer game development.

The inheritance is like the subclass of the object. Data hiding is a stage in oop where the codes or data are hidden from another users.

In the polymorphism stage, the object is given the ability to change to a sub-object, while in the interface stage a function or method signature is defined without implementing it.

3 0
3 years ago
Read 2 more answers
When is the redo log buffer written to the redo log file?
natka813 [3]

Answer: B)The redo log buffer becomes one-third full.

Explanation:Redo log buffer is the type of buffer file that is present for storing the changes that have been done in data. Database changes are the made goes in the records of the redo entries.the change of the buffer to the redo files is done when the buffer contains change records which are full till the one-third section, thus conversion takes place from the redo buffer to the redo files.

5 0
2 years ago
How do I turn on your asus chromebook flip?
galben [10]
I believe the charger has to be connected for it to turn on.
3 0
3 years ago
¿Que es una linea del tiempo?
DanielleElmas [232]
Una línea donde vas ordenando los hechos que han sucedido hasta el presente, aquí te dejo un ejemplo

•___________________________•
P. N. E. HISTORIA
A. E. D
L. O. M
E. L
O. I
L. T
I. I
T. C
I. O
C
I
6 0
2 years ago
Other questions:
  • How works GPS on boats?
    12·1 answer
  • Which scenario depicts an ethical workplace practice by a business owner? A. sharing personal information of its employees with
    8·2 answers
  • If K is a foreign key in relation R1, then
    10·1 answer
  • What is the different between ethical and legal issues?​
    6·1 answer
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • Which of the following is the BEST reason to use cash for making purchases? everfi
    15·1 answer
  • The sequence's insert member function normally puts a new item before the current item. What should insert do if there is no cur
    9·1 answer
  • WHAT IS A GOOD APP FOR REMOVING VIRUSES AND IT YOU DONT HAVE TO PAY MUCH FOR IT ????? PLEASE HELP ME
    8·2 answers
  • How you use ict today and how will you use it tomorrow
    14·1 answer
  • A computer has __________processing device
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!