<span>arts, audio-video technology & communications</span>
Answer:
<u>Window.java</u>
- public class Window {
- int width;
- int height;
-
- public Window(int width, int height){
- this.width = width;
- this.height = height;
- }
- public int getWidth(){
- return width;
- }
- public int getHeight(){
- return height;
- }
-
- public int getClientAreaHeight(){
- return getHeight();
- }
- }
<u>Main.java</u>
- public class Main {
- public static void main (String [] args) {
- Window win1 = new Window(12, 15);
- System.out.println(win1.getClientAreaHeight());
- }
- }
Explanation:
<u>Window.java</u>
There is a Window class with two int type attributes, width and height (Line 1 - 3).
The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).
The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).
<u>Main.java</u>
We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).
We shall see 15 is printed.
Answer: Registers
Explanation:
Registers are small storage locations identified by different types of registers. The function of the register is to provide data for immediate processing to the CPU. These registers hold data temporarily and provide easy access of data to the processor.
I guess you could say it offers a easier and faster way to facilitate the spread of information through visual displaying of the said information.
The size of the array shoeSize? double [] shoeSize = {8.5, 7, 12.5, 9.5, 9, 11.5, 6} is 6
Explanation:
- Arrays are zero-based : the seven elements of a 7-element array are numbered from 0 to 6. Hence, the size of the array is 6.
- An array is collection of items stored at memory locations. The main aim of an array is to store multiple items of same type together.
- An array is a collection of one or more values of the same type. Each value is called an element of the array.
- The location of an item in an array is known as array indexing.
- The first array index is 0 or 1 and indexes continue through the natural numbers.
- The upper bound of an array is generally language and possibly system specific.
- An array type is a data type that represents a collection of elements each selected by one or more identifying keys that can be computed at run time during program execution.