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
Why is Brainly always deleting either my answers or my questions? I am putting nothing inappropriate in them. Can someone answer
Artist 52 [7]

Answer:

hey i do not know

Explanation:

3 0
4 years ago
Read 2 more answers
What is a counter? In typography
Ostrovityanka [42]

answer:

in typography, it is an area entirely or partially enclosed by a letter form or a symbol

explanation:

・two types: closed & open

・closed —  A, B, D, O, P, Q, R, a, b, d, e, g, o, p, and q

・open — c, f, h, s

7 0
1 year ago
In addition to letting people share files, what is the most useful feature of
bekas [8.4K]

Explanation:

B. They combine and compress large files into a zip file for sending through email

5 0
2 years ago
What is a good practice to remember when adding transitions to a presentation?
storchak [24]

Answer:

A. Use one type of transition throughout.

Explanation:

Edge 2021.

7 0
3 years ago
Read 2 more answers
PLEASE HELP!!!
uysha [10]
The next line is 0___________________________
3 0
3 years ago
Other questions:
  • Which AWS service is a managed service that makes it easy to set up, operate, and scale a relational database in the cloud?​
    9·1 answer
  • Which two statements give good definitions of financial credit
    8·1 answer
  • Write a sequence of statements that finds the first comma in the string line, and assigns to the variable clause the portion of
    13·1 answer
  • When users talk about font size,
    10·2 answers
  • 4. How could you apply some of the ideas, principles, or structures of coding to fields of study, industries, or tasks outside o
    8·1 answer
  • System A has two processors. Program X takes 50 seconds to execute on one of the processors. Program Y takes 50 seconds to execu
    8·1 answer
  • Use the drop-down menus to match each description to the correct term.
    13·2 answers
  • Chief technology officers can influence a company's current and future ____.
    9·1 answer
  • What are some real-life situations that require a program that is iterative? Include at least three examples in your answer.
    7·2 answers
  • Yeoo check dis out!!!!!! wait my full vid dont show hol on
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!