D) People who try to irritate you and harass you in online games
Answer:
Explanation:
The following code is written in Java and like requested prompts the user for a number to continue or a letter to exit. Then loops and keeps adding all of the numbers to the sum variable and adding 1 to the count for each number entered. Finally, it prints the sum and the average using printf and the variables.
import java.util.Scanner;
class Examine1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int sum = 0;
int count = 0;
System.out.println("Enter a number to continue or a letter to exit.");
while(in.hasNextInt()) {
System.out.println("Enter a number:");
sum += in.nextInt();
count += 1;
}
System.out.printf("The sum is %s.%n", sum);
System.out.printf("The average is %s.", (sum / count));
}
}
Answer:
vocab = [ "Libraries", "Bandwidth", "Hierarchy", "Software", "Firewall", "Cybersecurity","Phishing", "Logic", "Productivity"]
print(vocab)
needNextPass = True
k = 1
#list = [x.lower() for x in list]
while k < len(vocab)-1 and needNextPass:
# List may be sorted and next pass not needed
needNextPass = False
for i in range(len(vocab) - k):
if vocab[i] > vocab[i + 1]:
# swap list[i] with list[i + 1]
temp = vocab[i]
vocab[i] = vocab[i + 1]
vocab[i + 1] = temp
needNextPass = True # Next pass still needed
print(vocab)
Explanation:
I hope this helps you!
An API is in computer programming. So it is an application programming interface is a set of several subroutine definitions. Also consists of Communication protocols and tools for you to build software.
Also known by its full names, Application Programming Interface. I was just going to ask it myself actually.
I hope this helps and good question?
Answer:
Pseudocode is as follows:
// below is a function that takes two parameters:1. An array of items 2. An integer for weight W
// it returns an array of selected items which satisfy the given condition of sum <= max sum.
function findSubset( array items[], integer W)
{
initialize:
maxSum = 0;
ansArray = [];
// take each "item" from array to create all possible combinations of arrays by comparing with "W" and // "maxSum"
start the loop:
// include item in the ansArray[]
ansArray.push(item);
// remove the item from the items[]
items.pop(item);
ansArray.push(item1);
start the while loop(sum(ansArray[]) <= W):
// exclude the element already included and start including till
if (sum(ansArray[]) > maxSum)
// if true then include item in ansArray[]
ansArray.push(item);
// update the maxSum
maxSum = sum(ansArray[items]);
else
// move to next element
continue;
end the loop;
// again make the item[] same by pushing the popped element
items.push(item);
end the loop;
return the ansArray[]
}
Explanation:
You can find example to implement the algorithm.