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:
i. This value was not accepted because we have 12 months and not 13.
ii. This is because the user entered the value for the day as value for the month.
Explanation:
i. Why was this not accepted?
This value was not accepted because we have 12 months and not 13. The user entered a value that was above the maximum value registered for the number of months in a year- which is 12.
ii. Why do you think this error occurred
This is because the user entered the value for the day as value for the month.
This could be because the user uses a date system different from that of the program.
Answer:
Open source software
Explanation:
Open source software is exactly what you think it is, the code to compile the software and run it is available to the public for use or modification.
Answer:
7 bytes
Explanation:
<u>2 Address Instruction</u>
The 2 address instruction consist 3 components in the format.
One is opcode,other two are addresses of destination and source.
<u>Example-</u>
load b,c | Opcode destination address,source address
add a,d | Opcode destination address,source address
sub c,f | Opcode destination address,source address
Opcode consists of 1 bytes whereas destination address and source address consist of 3 bytes each.
(1+3+3) bytes=7 bytes
Aaaaaaaaaaaaaaaaaaaaaaaaaaaa