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
What is the error in the following line: (1)<br><br> age=int(input("Enter your age:")
Ainat [17]

Answer:

14

Explanation:

6 0
3 years ago
Also known as the hard disk, the ______ is the primary storage device of a personal computer. You can also buy an external _____
Stolb23 [73]

Another name for hard disk is called; Hard Drive

The external hard disk is called; External Hard drive

<h3>Computer storage devices</h3>

In computers there are different ways of storing information and all could come under the name drives but the primary storage of a computer which is called hard disk is also called hard drive.

Now, the hard drive could be internal or external and so the one to store additional information is called External Hard Drive.

Read more about Computer Storage Devices at; brainly.com/question/19667078

5 0
2 years ago
Which of the following refers to programs that install themselves on computers without the users' knowledge or permission and sp
defon

Answer:

The correct answer is C "Computer Virus"

Explanation:

Computer virus is a piece of code that install itself in a computer without the knowledge and permission of the user and start replicating itself and as it execute it self also start damaging the computer files.

Computer virus have ability to replicate itself and it attached to files and move from one computer to another with these files when files are transferred.

5 0
4 years ago
A ______ object is used for displaying the results of a question based on stored data.
LekaFEV [45]

Answer:

B. report

Explanation:

Report is used to show the result of data base quires or stored data contain useful data use in decision making and analysis.

It is also called a report generator, it is a part of database management system that is used to extract information from one or more files and present it in specific format.

4 0
3 years ago
Write a method transpose, that takes as argument a 2D array of integers, myTable, and returns the transpose of myTable. The tran
Gelneren [198K]

Answer:

The program to this question can be given as:

Program:

import java.util.*; //import package

public class Main //defining class

{

public static int[][] transpose(int[][] a1) //defining function transpose

{

int i,j; //define variables

int[][] transpose = new int[a1[0].length][a1.length]; //define variable transpose.

//loop for transpose matrix.

for(i = 0; i < a1.length; i++)  

{

for(j = 0; j < a1[i].length; j++)

{

transpose [j][i] = a1[i][j]; //hold value in transpose variable

}

}

return transpose ; //return transpose matrix.  

}

public static void main(String[] args) //main method.

{

int row,col,i,j; //defining variable.

Scanner obj = new Scanner(System.in); //creating Scanner class Object

System.out.print("Enter number of rows: ");//message

row = obj.nextInt(); //input rows form user.

System.out.print("Enter number of columns: ");//message

col = obj.nextInt(); //input columns form user.

int[][] a1 = new int[row][col]; //defining array.

System.out.println("Enter matrix"); //message

// loop for input array elements from user

for(i=0; i<a1.length;i++)  

{

for(j=0; j<a1[i].length;j++)  

{

a1[i][j]=obj.nextInt(); //input in array variable.

}

}

System.out.println("Matrix you insert :"); //message

// loop for display array.

for(i=0; i<a1.length;i++)  

{

for(j=0; j<a1[i].length;j++)  

{

System.out.print(a1[i][j]+" "); //print matrix

}

System.out.print("\n");

}

int[][] result = transpose(a1); //define result array variable that holds function value.

System.out.println("Transposed matrix is :");

//use loop for print Transpose matrix.

for(i = 0;i < result.length;i++)

{

for (j = 0; j < result[i].length;j++)

{

System.out.print(result[i][j] + " "); //print matrix

}

System.out.print("\n");

}

}

}

Output:

Enter number of rows: 2

Enter number of columns: 3

Enter matrix

2

3

4

9

8

7

Matrix you insert :

2 3 4  

9 8 7  

Transposed matrix is :

2 9  

3 8  

4 7  

Explanation:

The description of the above program can be given as:

  • In the above program firstly import a package, then declare a class that is "Main" inside a class defining a transpose() function this function returns a matrix in transpose form.
  • In the main class, we define a variable and matrix that is "row, col, i, j and a1[][]".  Then we Creating a scanner class object, which is used by row, col and a1[][] variables for user input.  
  • The row and col variables are used to declare matrix size and i, j variable is used in the loop for insert and display matrix.  
  • a1[][] matrix is used for input matrix elements and passes into transpose() function as an argument that returns a value that is held in the result variable. This is used as a loop for the print transpose matrix.

5 0
3 years ago
Other questions:
  • Side mirror using convex mirror or concave mirror?​
    5·2 answers
  • Consider a three sequentially stepped process named as Process A, Process B and Process C. Input comes into Process A. Output fo
    13·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • Want to.learn about computers​
    9·1 answer
  • In what way do media and networks interact? A.) Media are connected to networks tat make information easier to share. B.) Networ
    8·1 answer
  • What is the difference between word processing software and presentation software​
    9·1 answer
  • 3. Output the following:<br>a.<br>21%4​
    12·1 answer
  • Means storing,accessing information over the internet other than hard drive and your system
    15·1 answer
  • What are the data type(s) will be used to declare the variable(s) needed to
    9·1 answer
  • Explain the importance of the educational apps.give an example to support your answer ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!