1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
drek231 [11]
3 years ago
9

What is the value of the magicPowers variable after executing the following code snippet? String magicPowers = ""; int experienc

eLevel = 9; if (experienceLevel > 10) { magicPowers = magicPowers + "Golden sword "; } if (experienceLevel > 8) { magicPowers = magicPowers + "Shining lantern "; } if (experienceLevel > 2) { magicPowers = magicPowers + "Magic beans "; }

Engineering
1 answer:
Evgen [1.6K]3 years ago
5 0

Answer:

Shining lantern Magic beans                

Explanation:

I will explain the code line by line.

The first statement contains a string type variable magicPowers and second statement has an int type variable experienceLevel which is initialized by value 9.

Nested if statement are used and lets see which of those statements execute.

The first if statement checks if the value of experienceLevel is greater than 10. This statement evaluates to false because the value of experienceLevel is set to 9. Then the program control moves to the next if statement.

The second if statement checks if the value of experienceLevel is greater than 8. This if condition evaluates to true because the value of experienceLevel  is 9. So this if statement is executed which contains the statement magicPowers = magicPowers + "Shining lantern "; . This means magicPowers stores the string Shining lantern.

The third if statement checks if the value of experienceLevel  is greater than 2. As the value of experienceLevel  is 9 so this condition also evaluates to true which means the statement magicPowers = magicPowers + "Magic beans "; is executed. This statement means magicPowers stores the string Magic Beans

You can use a print statement to display the output on the screen as:

System.out.print(magicPowers);

Output:

Shining lantern Magic beans        

The program along with the output is attached as a screenshot.

You might be interested in
Concrete ___ support and anchor the bottom of steel columns and wood post, which support beams that are pare of framing system o
dolphi86 [110]
I wanna say it’s D post support
3 0
2 years ago
If you add 10 J of heat to a system so that the final temperature of the system is 200K, what is the change in entropy of the sy
Elden [556K]

Answer:

0.05 J/K

Explanation:

Given data in question

heat (Q) = 10 J

temperature (T) = 200 K

to find out

the change in entropy of the system

Solution

we will solve this by the entropy change equation

i.e  ΔS = ΔQ/T           ...................1

put the value of heat Q and Temperature T in equation 1

ΔS is the enthalpy change and T is the temperature

so  ΔS = 10/200

ΔS = 0.05 J/K

8 0
3 years ago
Open the"stateData3.c" program and try to understand how the tokenization works. If you open the input file "stateData.txt", you
babymother [125]

Answer:

Kindly see explaination

Explanation:

Code

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#define size 200

int main(void)

{

int const numStates = 50;

char tempBuffer[size];

char tmp[size];

char fileName[] = "stateData.txt"; // Name of the text file (input file) which contains states and its populations

char outFile[] = "stateDataOutput1.txt"; // Output file name

// Open the input file, quit if it fails...

FILE *instream = fopen(fileName, "r");

/* Output File variable */

FILE *opstream;

if(instream == NULL) {

fprintf(stderr, "Unable to open file: %s\n", fileName);

exit(1);

}

//TODO: Open the output file in write ("w") mode

/* Opening output file in write mode */

opstream = fopen(outFile, "w");

//TODO: Read the file, line by line and write each line into the output file

//Reading data from file

while(fgets(tmp, size, instream) != NULL)

{

//Writing data to file

fputs(tmp, opstream);

}

// Close the input file

fclose(instream);

//TODO: Close the output file

/* Closing output file */

fclose(opstream);

return 0;

}

5 0
3 years ago
Why is oil black and why does oil look black
Rina8888 [55]

Answer:While heat cycles cause oil to darken, soot causes oil to turn black

Explanation:

Most people associate soot with diesel engines, but gasoline engines can produce soot as well, particularly modern gasoline-direct-injection engines. ... Any finer filtration and the filter could catch dissolved additives in the motor oil

4 0
2 years ago
Can you guys please introduce yourself​
EleoNora [17]

Answer: why?

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • A large well-mixed tank of unknown volume, open to the atmosphere initially, contains pure water. The initial height of the solu
    12·1 answer
  • Which one of the following statements about the Wright brothers is not true?
    6·1 answer
  • Drag each tile to the correct box.
    15·1 answer
  • A mass of 0.3 kg is suspended from a spring of stiffness 0.4 N/mm. The damping is 3.286335345 kg/s. What is the undamped natural
    5·1 answer
  • A shaft is made of an aluminum alloy having an allowable shear stress of τallow = 100 MPa. If the diameter of the shaft is 100 m
    13·2 answers
  • If a machine uses LESS effort to overcome a given resistance force (if Fe is less than FR), it has an actual mechanical advantag
    13·1 answer
  • What are the desired characteristics or values for the following parameters of an ideal amplifier?o Phase change as a function o
    10·1 answer
  • Plot da(t) if the output voltage of the converter pole-a is vaN(t)=Vd/2+0.85 Vd/2 sin(Ï1t), where Ï1=2Ï x 60 rad/s
    12·1 answer
  • The technique of smoothing out joint compound on either side of a joint is known as which of the following
    14·1 answer
  • a storage tank contains liquid with a density of 0.0361 lbs per cubic inch. the height of liquid in the tank is 168 feet. what i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!