Answer:
The program is as follows:
i = 1
while(i<11):
j = 1
while(j<=i):
print('*', end = '')
j += 1
i += 1
print()
Explanation:
Initialize i to 1
i = 1
The outer loop is repeated as long as i is less than 11
while(i<11):
Initialize j to 1
j = 1
The inner loop is repeated as long as j is less than or equal i
while(j<=i):
This prints a *
print('*', end = '')
This increments j and ends the inner loop
j += 1
This increments i
i += 1
This prints a blank and ends the inner loop
print()
Answer:
A private plane pilot is a mid-level position.
Explanation:
The six pilot certifications in the US are as follows:
- Sport Pilot
- Recreational Pilot
- Private Plane Pilot
- Commercial Plane Pilot
- Flight Instructor
- Airline Transport Pilot
From this listing, it is evident that the Private Plane Pilot is in the mid of the line so it is a mid-level position.
Answer:A. 40% B.50% C. 60% Od 70%
Explanation:A. True B. False
Answer:
The solution code is written in Java.
- public class Main {
-
- public static void main(String[] args) {
-
- Scanner inNum = new Scanner(System.in);
- System.out.print("Enter number of toss: ");
- int num = inNum.nextInt();
-
- for(int i=0; i < num; i++){
- System.out.println(toss());
- }
- }
-
- public static String toss(){
- String option[] = {"heads", "tails"};
- Random rand = new Random();
- return option[rand.nextInt(2)];
- }
- }
Explanation:
Firstly, we create a function <em>toss()</em> with no parameter but will return a string (Line 14). Within the function body, create an option array with two elements, "heads" and "tails" (Line 15). Next create a Random object (Line 16) and use <em>nextInt()</em> method to get random value either 0 or 1. Please note we need to pass the value of 2 into <em>nextInx() </em>method to ensure the random value generated is either 0 or 1. We use this generate random value as an index of <em>option </em>array and return either "heads" or "tails" as output (Line 17).
In the main program, we create Scanner object and use it to prompt user to input an number for how many times to toss the coin (Line 6 - 7). Next, we use the input num to control how many times a for loop should run (Line 9). In each round of the loop, call the function <em>toss() </em>and print the output to terminal (Line 10).
Answer:
b. False
Explanation:
A centimeter is a hundredth of a meter. This means 1/100 ,1 cm = 0.01 m
A kilo is 1000 grams.
The first answer is false because a hundredth isnot written well.
The second statement is false because the comparison given is of different units of measure. For distance is meters where as for weight is kilograms.