Answer:
import java.util.*;
public class Country
{
public static void main(String args[])
{
char ch,temp;
int flag = 0;
String country;
ArrayList<String> countries = new ArrayList<String>();
Scanner sc = new Scanner(System.in);
do
{
System.out.println("enter the country you have visited:\t");
country = sc.next();
for(int i=0;i<countries.size();i++)
{
if(countries.get(i).equals(country))
{
System.out.println("you have already entered the country");
flag = 1;
break;
}
}
if(flag == 0)
{
countries.add(country);
flag = 0;
}
System.out.println("want to add another country(y/n):\t");
ch = sc.next().charAt(0);
}while(ch!='n');
Collections.sort(countries);
System.out.println("Countries you have visited:\t"+countries);
System.out.println("Total number of contries visited:"+countries.size());
}
}
Explanation:
Answer:
the higher order bits in AL will be true
Explanation:
We know from the truth table that in an OR operation, once one operand is true the result is true, no matter the value of the other operand. From the above AL will have the higher order bits to be true since the first four higher order bits are 1s, 1111_0000, this is regardless of the original values of AL. We cannot however ascertain if the lower bits of AL are true from this. Note 1 evaluates to true while 0 is false
typing with macros
typing with only one hand
typing without looking at the keyboard
Answer:
50 ms (milliseconds) will be taken in total to take the entire file by user.
Explanation:
In Computer networks, propagation delay is defined as the time in which a packet is sent from sender to receiver completely. It is computed by taking the ratio of link length and propagation speed.
We know that:
BDP(in bits) = total bandwidth (in bits/sec) * trip time(in sec)
Now according to given condition we have:
Bandwidth = R = 10 Mbps = 10,000,000 bps
BDP = 500,000 bits
For finding Propagation Delay:
Propagation Delay = BDP/ R
Propagation Delay = 500,000/10,000,000 sec
Propagation Delay = 0.05 sec
Converting in milliseconds:
Propagation Delay = 50 ms
Hence. the delay would be 0.05 seconds and in milliseconds they will be equal to 50 ms
Answer:
This program is written in C++
Comment are used to explain difficult lines
The first program that prints 0 to 20 (in decimal) starts here
#include<iostream>
int main()
{
//Print From 0 to 20
for(int i = 0;i<21;i++)
{
std::cout<<i<<'\n';
}
}
The modified program to print 0 to 20 in hexadecimal starts here
#include<iostream>
using namespace std;
int main()
{
//Declare variables to use in conversion;
int tempvar, i=1,remain;
//Declare a char array of length 50 to hold result
char result[50];
//Print 0
cout<<"0"<<endl;
// Iterate from 1 to 20
for(int digit = 1; digit<21; digit++)
{
//Start Conversion Process
//Initialize tempvar to digit (1 to 20)
tempvar = digit;
while(tempvar!=0)
{
//Divide tempvar by 16 and get remainder
remain = tempvar%16;
if(remain<10)
{
result[i++]=remain + 48;
}
else
{
result[i++] = remain + 55;
}
//Get new value of tempvar by dividing it by 16
tempvar/=16;
}
//Print result
for(int l=i-1;l>0;l--)
{
cout<<result[l];
}
i=1;
cout<<endl;
}
return 0;
}
//The Program Ends Here
See Attachments for program 1 and 2; program 2 is the modified version of 1
Answer:
Well, I am studying software engineering and ethical hacking, with the terms I mentioned it is very self explanatory how I use computers for those fields. In case it is still not self explanatory, we use computers to make software and websites accessing tools that can only be access using a computer and a working internet connection is required. Ethical hacking requires a computer to test the website or application security in order to do that we need a active internet connection in order to access the website itself.
Explanation:
i dont really know i am not really sure what i qill be in the future
The electric bill program illustrates the use of loops (i.e. iteration)
Loops are used to execute repetitive operations
The electric bill program in Python where comments are used to explain each line is as follows:
#This iteration shows that the process is repeated for 50 consumers
for i in range(50):
#This gets input for the consumer name meter number
mno = input("Consumer name meter number: ")
#This gets input for last month reading
lmr = int(input("Last month reading: "))
#This gets input for current month reading
cmr = int(input("Current month reading: "))
#This calculates the number of units
Nou = cmr - lmr
#This calculates the bills
bill = Nou*2
#This calculates the tax
tax = bill*0.15
#This calculates the netbills
netbill = bill+tax
#This next four lines print the electric bills
print("Number of units:",Nou)
print("Bills:",bill)
print("Tax:",tax)
print("Netbill:",netbill)
Read more about loops at: