Answer:
The Java code is given below with appropriate comments
Explanation:
import java.util.Scanner;
public class Temperature {
public static void main(String[] args)
{
// declaring the temperatures array
double[] maxTemp = new double[12];
double[] lowTemp = new double[12];
double avgHighTemp = 0;
double avgLowTemp = 0;
Scanner kb = new Scanner(System.in);
System.out.println("Please enter the highest and lowest temperatures");
System.out.println("of each month one by one below\n");
// inputting the temperatures one by one
for(int i = 0; i < 12; i++)
{
System.out.print("Please enter the highest temperature for month #" + (i+1) + ": ");
maxTemp[i] = Integer.parseInt(kb.nextLine());
System.out.print("Please enter the lowest temperature for month #" + (i+1) + ": ");
lowTemp[i] = Integer.parseInt(kb.nextLine());
System.out.println();
}
avgHighTemp = getAvgHighTemperature(maxTemp);
avgLowTemp = getAvgLowTemperature(lowTemp);
System.out.printf("Average high temperature is: %.2f\n", avgHighTemp);
System.out.printf("Average low temperature is: %.2f\n", avgLowTemp);
}
// method to calculate the average high temperature
public static double getAvgHighTemperature(double[] highTemp)
{
double total = 0;
for(int i = 0; i < 12; i++)
{
total += highTemp[i];
}
return total/12;
}
// method to calculate the average low temperature
public static double getAvgLowTemperature(double[] lowTemp)
{
double total = 0;
for(int i = 0; i < 12; i++)
{
total += lowTemp[i];
}
return total/12;
}
}
Answer:
a. 7 bits
b. 8 bits
c. 9 bits
d. 24 bits
Explanation:
Required
Number of bits per word
The formula to get the number of bits per word is:
Where
n = bits
N = numbers
Solving (a) 0 to 100
There are 101 digits between 0 and 100 (inclusive)
So:
Substitute 101 for N in
101 can not be expressed as an exponent of 2.
So, we substitute 101 for the closest number greater than 101 that can be expressed as an exponent of 2.
So:
Express 128 as an exponent of 2
Apply law of indices
Hence, 7 bits are required
Solving (b): 0 through 255
There are 256 digits between 0 and 255 (inclusive)
So:
Substitute 256 for N in
Express 256 as an exponent of 2
Apply law of indices
Hence, 8 bits are required
Solving (c): 0 through 256
There are 257 digits between 0 and 256 (inclusive)
So:
Substitute 257 for N in
257 can not be expressed as an exponent of 2.
So, we substitute 257 for the closest number greater than 101 that can be expressed as an exponent of 2.
So:
Express 512 as an exponent of 2
Apply law of indices
Hence, 9 bits are required
Solving (d): 0 through 10000000
There are 10000001 digits between 0 and 10000000 (inclusive)
So:
Substitute 10000000 for N in
10000000 can not be expressed as an exponent of 2.
So, we substitute 10000000 for the closest number greater than 101 that can be expressed as an exponent of 2.
So:
Express 16777216 as an exponent of 2
Apply law of indices
Hence, 24 bits are required
Answer:
Wireshark.
Explanation:
Wireshark is a free and open source network packet sniffing tool, used for analysing, troubleshooting, software and communication protocol development etc.
It uses various extensions to capture wireless and cabled connections like AirPcap (air packet capture), pcapng ( packet capture next generation.
It uses the device's antenna to capture wireless communication and gives the signal strength, noise ratio and other information of the antenna.
Answer:
It returns the lookup value located in a specific location.
Explanation:
Answer: Major components of a computer based information system:-
Explanation: The basic components of a computer based information system are :
Answer:
39
Explanation:
Since each of the address occupies only 1 memory cell and the 2-D array is row-major 2-D array.So the elements will be filled row wise.First the first row will be fully filled after that second row and so on.Since we want the address of the element at third row and fourth column.
we can generalize this :
address of the element at ith row and jth column=s + ( c * ( i - 1 ) + ( j - 1 ) ).
s=Starting address.
c=Number of columns in the 2-D array.
address=20+(8*(3-1)+(4-1))
=20+(8*2+3)
=20+16+3
=39
Or you can make a matrix of six rows and eight columns and put first cell with 20.Start filling the elements row wise one by one and look what is the count of 3rd row and 4th column.