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
Marrrta [24]
3 years ago
9

Write a subclass named 'ReadWrite' with the following additional behavior: Any necessary constructors. a method named 'setVal' t

hat 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:
nataly862011 [7]3 years ago
6 0

Answer:

Java Class given below

Explanation:

class ReadOnly

{

protected int val;

public ReadOnly(int arg)

{

val = arg;

}

public int getVal()

{

return val;

}

}

class ReadWrite extends ReadOnly

{

private boolean dirty;

public ReadWrite(int arg)

{

super(arg);

dirty = false;

}

public void setVal(int arg)

{

val = arg;

dirty = true;

}

public boolean isDirty()

{

return dirty;

}

}

You might be interested in
What is RAM? explain it
Zina [86]
RAM is memory in the computer
3 0
3 years ago
Read 2 more answers
(a) Store last 7 digits of your student ID in a vector (7 element row or column vector). Write a MATLAB code which creates a 7x7
astra-53 [7]

Answer:

MATLAB code explained below with appropriate comments for better understanding

Explanation:

clc

clear all

ID = [1 2 3 4 5 6 7]; % Replace this with your student ID

%(a)

A = zeros(7);

for i=1:7

 

A(i,i)= ID(i);

 

end

fprintf('A =\n');

disp(A);

B = diag(ID);

fprintf('B =\n');

disp(B);

fprintf('Both A and B are same\n');

%(b)

if(mod(A(6,6),2)==0)

fprintf('A(6,6) is even\n');

else

fprintf('A(6,6) is odd\n');

end

%(c)

if(A(3,3)>0)

fprintf('A(3,3) is positive\n');

else if(A(3,3)<0)

fprintf('A(3,3) is negative\n');

else

fprintf('A(3,3)=0\n');

end

end

%(d)

fprintf('\nRequired series : ');

n = 35;

while n>=0

fprintf('%i',n);

if(n>0)

fprintf(', ');

end

n = n - 5;

end

fprintf('\n');

%(e)

n = input('\nInput an integer : ');

fprintf('%i! = ',n);

F = 1;

while n>1

F = F * n;

n = n - 1;

end

fprintf('%i\n',F);

%(f)

clear all

x = [3 7 2 1];

y = [4 3 9 1];

A = 0;

C = x(1);

for i=1:length(x)

A = A + x(i)*y(i);

B(i) = x(i)/y(i);

if(min(x(i),y(i))<C)

C = min(x(i),y(i));

end

end

C = 1/C;

fprintf('\nA = %i\n',A);

fprintf('B = ');

disp(B)

fprintf('C = %0.5g\n',C);

%(g)

clear all

A = randi([5 25],[1,10]);

maxA = A(1);

for i = 2:10

if(maxA<A(i))

maxA = A(i);

end

end

minA = A(1);

i = 2;

while i<11

if(minA>A(i))

minA = A(i);

end

i = i+1;

end

fprintf('\nA = ');

disp(A);

fprintf('maxA = %i\n',maxA);

fprintf('minA = %i\n',minA);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%output

A =

1 0 0 0 0 0 0

0 2 0 0 0 0 0

0 0 3 0 0 0 0

0 0 0 4 0 0 0

0 0 0 0 5 0 0

0 0 0 0 0 6 0

0 0 0 0 0 0 7

B =

1 0 0 0 0 0 0

0 2 0 0 0 0 0

0 0 3 0 0 0 0

0 0 0 4 0 0 0

0 0 0 0 5 0 0

0 0 0 0 0 6 0

0 0 0 0 0 0 7

Both A and B are same

A(6,6) is even

A(3,3) is positive

Required series : 35, 30, 25, 20, 15, 10, 5, 0

Input an integer : 6

6! = 720

A = 52

B = 0.7500 2.3333 0.2222 1.0000

C = 1

A = 25 14 7 10 13 17 10 17 19 9

maxA = 25

minA = 7

>>

5 0
2 years ago
Select the steps for adding artwork into a placeholder on a presentation slide
Sloan [31]

Answer:

   Open the presentation that you want to add a slide to.

   In the pane that contains the Outline and Slides tabs, click Slides, and then click where you want to add a slide.

Explanation:

6 0
3 years ago
why is it useful to learn how to solve and program solutions with a limited set of command in computer science
12345 [234]

Answer:

Give at least one reason why it's useful to learn how to solve and program solutions with a limited set of commands. So that when there is more commands we know how to use the ones we have. parameters help generalize the solution to a specific problem. how are functions with parameters an example of abstraction?

4 0
2 years ago
Effective nonverbal communication can cause tension.<br><br> True or False
agasfer [191]

Explanation:

When your nonverbal signals match up with the words you're saying, they increase trust, clarity, and rapport. When they don't, they can generate tension, mistrust, and confusion.

4 0
3 years ago
Other questions:
  • What component on a smartphone requires pairing with another device?
    8·1 answer
  • All of the following are incentives proprietary schools use to attract a student except
    7·2 answers
  • The area on your screen where you can access the tab and menu options for word is called what?
    8·2 answers
  • Company policies require that all network infrastructure devices send system level information to a centralized server. Which of
    6·1 answer
  • The goal expressed in this definition states that data visualization is about ________________ .
    11·2 answers
  • In Java:
    15·1 answer
  • U $ er Ideas for R 0 B 1 0 X?
    12·2 answers
  • I NEED HELP, DO ASAP <br> Why do you have to adjust toys for different ages?
    11·2 answers
  • Select the correct answer. Which step references adding color, size, and media format in your digital portfolio? A. identifying
    6·1 answer
  • ____must cooperate with each other to neutralize the global threat of information censorship. Select 3 options.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!