The cyber community is important because it is a way to connect with other people without having to be with them
Answer:(c) abstract class A { abstract void unfinished(); }
Explanation:
A legal abstract class must have the keyword abstract before the class and an abstract class has abstract functions with the keyword abstract written and a void as the return type.
The answer is C) tablet. You use the touch screen keyboard for that.
Answer:
Java code is given below
Explanation:
import java.util.Random;
class Die{
private int sides;
public Die(){
sides = 6;
}
public Die(int s){
sides = s;
}
public int Roll(){
Random r = new Random();
return r.nextInt(6)+1;
}
}
class DieRoll{
public static void main(String[] args) {
Die die = new Die();
int arr[] = new int[6];
for(int i=0; i<6; i++)
arr[i] = 0;
for(int i=0; i<100; i++){
int r = die.Roll();
arr[r-1]++;
}
for(int i=0; i<6; i++)
System.out.println((i+1)+" was rolled "+arr[i]+" times.");
}
}
Program in Python
val = 0
total = 0
while (val < 10):
val = val + 1
total = total + val
print(total)
Answer:
Prints the sum of the numbers from 1 to 10.
Explanation:
Given
The above lines of code
Required
What does the loop do?
To know what the loop does, we need to analyze the program line by line
The next two lines initialize val and total to 0 respectively
<em>val = 0 </em>
<em>total = 0 </em>
The following iteration is repeated while val is less than 10
while (val < 10):
This increases val by 1
val = val + 1
This adds val to total
total = total + val
This prints the value of total
print(total)
Note that the loop will be repeated 10 times and in each loop, val is incremented by 1.
The values of val is 1 to 10.
The summation of these value is then saved in total and printed afterwards.
<em>Hence, the loop adds numbers from 1 to 10</em>