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
ira [324]
3 years ago
14

What will be the result of running the following code fragment? int year = 0; double rate = 5; double principal = 10000; double

interest = 0; while (year < 10) { interest = (principal * year * rate) / 100; System.out.println("Interest " + interest); }
Computers and Technology
1 answer:
NemiM [27]3 years ago
5 0

Answer:

This code fragment will run an infinite loop

Explanation:

This output: Interest 0.0 Will be displayed infinitely. The reason is because the variable year which is initially set to 0 is never updated and as such remains true because the condition is while(year<10). So at the first iteration the statement interest = (principal * year * rate) / 100; evaluates to 0 and this line of code System.out.println("Interest " + interest); prints Interest 0.0. At the next iteration the same evaluation and output takes place and on and on and on....... since the control variable is not changing.

You might be interested in
1) what are two functions of a pick or count condition?
viktelen [127]
1.  The best option is C) pick an object at random, and keep track of how many copies of an object are left in a game.
2.   The best option is D) clockwise and counterclockwise.
3.    your 3rd question does not seem to be clear to me.
3 0
3 years ago
Which of these can be represented visually by a flowchart?
Mariana [72]

Answer:

i think its C.

if its wrong i'm truly sorry

Explanation:

4 0
3 years ago
Read 2 more answers
Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
ValentinkaMS [17]

Answer:

I think its A

Explanation:

6 0
3 years ago
How could the following line of code be shortened?
Alinara [238K]

Answer:

2

Explanation:

The second option is the only one that will work. The last would work but doesn't make the code any shorter.

8 0
2 years ago
You are going to visit a national park, and have never been there before. You are using a map to try and make the distance trave
Firdavs [7]

Answer:

eggs fishing didn't ysjffj

8 0
3 years ago
Other questions:
  • Create a cell array, called A, with the following contents: a. Make a copy of A called B. (Nothing complicated: B = A is suffici
    10·1 answer
  • This is for the folks that is rude:
    12·1 answer
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • A ________ is a material deficiency, or combination of significant deficiencies, that results in more than a remote likelihood t
    6·1 answer
  • Characteristics of successful entrepreneurs include
    11·1 answer
  • Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
    11·1 answer
  • Random Access Memory is tempory computer memory that stores works in progress
    7·1 answer
  • Freeeee BRAINLIESTHBJHBJHB
    8·2 answers
  • Justine was interested in learning how to play the piano. She has successfully passed every level of music book and is planning
    10·1 answer
  • An analog video is a video signal transmitted by an analog signal, captured on a (blank)
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!